Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update joy4 and ffmpeg. #160

Merged
merged 4 commits into from
Nov 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jobs:
build:
working_directory: /go/src/github.com/livepeer/lpms
docker:
- image: "circleci/golang:1.11.5"
- image: "circleci/golang:1.13.4"
environment:
GOROOT: /usr/local/go
PKG_CONFIG_PATH: "/home/circleci/compiled/lib/pkgconfig"
Expand All @@ -23,7 +23,7 @@ jobs:
name: "Build FFMpeg"
command: |
sudo apt-get update
sudo apt-get install -y autoconf build-essential pkg-config autoconf gnutls-dev
sudo apt-get install -y autoconf build-essential pkg-config autoconf gnutls-dev zlib1g-dev netcat-openbsd
bash ./install_ffmpeg.sh

- save_cache:
Expand Down
14 changes: 0 additions & 14 deletions ffmpeg/ffmpeg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1018,20 +1018,6 @@ func TestTranscoder_StreamCopyAndDrop(t *testing.T) {
`
run(cmd)

// Test failure of audio copy in mpegts-to-(not-mp4). eg, flv
// Fixing this requires using the aac_adtstoasc bitstream filter.
// (mp4 muxer automatically inserts it if necessary; others don't)
in.Fname = "../transcoder/test.ts"
out = []TranscodeOptions{TranscodeOptions{
Oname: dir + "/fail.flv",
VideoEncoder: ComponentOptions{Name: "drop"},
AudioEncoder: ComponentOptions{Name: "copy"},
}}
_, err = Transcode3(in, out)
if err == nil || err.Error() != "Invalid data found when processing input" {
t.Error("Expected error converting audio from ts to flv but got ", err)
}

// Encode one stream of a short sample while copying / dropping another
in.Fname = dir + "/test-short.ts"
out = []TranscodeOptions{TranscodeOptions{
Expand Down
19 changes: 16 additions & 3 deletions ffmpeg/nvidia_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,23 @@ func TestNvidia_DrainFilters(t *testing.T) {
set -eux
cd "$0"
# ensure we have a 100fps output
# sanity check with ffmpeg itself
ffmpeg -loglevel warning -i test.ts -c:a copy -c:v libx264 -vf fps=100 -vsync 0 ffmpeg-out.ts
ffprobe -loglevel warning -show_streams -select_streams v -count_frames ffmpeg-out.ts > ffmpeg,out
grep nb_read_frames ffmpeg,out > ffmpeg-read-frames.out
grep duration= ffmpeg,out > ffmpeg-duration.out
# ensure output has correct fps and duration
ffprobe -loglevel warning -show_streams -select_streams v -count_frames out.ts > probe.out
grep nb_read_frames=100 probe.out
grep duration=1.00 probe.out
grep nb_read_frames probe.out > read-frames.out
diff -u ffmpeg-read-frames.out read-frames.out
grep duration= probe.out > duration.out
diff -u ffmpeg-duration.out duration.out
# actual values - these are not *that* important as long as they're
# reasonable and match ffmpeg's
grep nb_read_frames=102 probe.out
grep duration=1.0200 probe.out
`
run(cmd)

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ go 1.12

require (
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/livepeer/joy4 v0.1.1
github.com/livepeer/joy4 v0.1.2-0.20191121080656-b2fea45cbded
github.com/livepeer/m3u8 v0.11.0
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/livepeer/joy4 v0.1.1 h1:Tz7gVcmvpG/nfUKHU+XJn6Qke/k32mTWMiH9qB0bhnM=
github.com/livepeer/joy4 v0.1.1/go.mod h1:xkDdm+akniYxVT9KW1Y2Y7Hso6aW+rZObz3nrA9yTHw=
github.com/livepeer/joy4 v0.1.2-0.20191121080656-b2fea45cbded h1:ZQlvR5RB4nfT+cOQee+WqmaDOgGtP2oDMhcVvR4L0yA=
github.com/livepeer/joy4 v0.1.2-0.20191121080656-b2fea45cbded/go.mod h1:xkDdm+akniYxVT9KW1Y2Y7Hso6aW+rZObz3nrA9yTHw=
github.com/livepeer/m3u8 v0.11.0 h1:aI2hLXV5h5VqxjjmAOs55TpUR35KzNL2XWLkbETql5g=
github.com/livepeer/m3u8 v0.11.0/go.mod h1:IUqAtwWPAG2CblfQa4SVzTQoDcEMPyfNOaBSxqHMS04=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
2 changes: 1 addition & 1 deletion install_ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if [ ! -e "$HOME/x264/x264" ]; then
fi

if [ ! -e "$HOME/ffmpeg/libavcodec/libavcodec.a" ]; then
git clone -b n4.1 https://git.ffmpeg.org/ffmpeg.git "$HOME/ffmpeg" || echo "FFmpeg dir already exists"
git clone -b livepeer-2019_11_19 https://github.com/livepeer/FFmpeg "$HOME/ffmpeg" || echo "FFmpeg dir already exists"
cd "$HOME/ffmpeg"
./configure --prefix="$HOME/compiled" --enable-libx264 --enable-gnutls --enable-gpl --enable-static
make
Expand Down
16 changes: 3 additions & 13 deletions segmenter/video_segmenter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,22 +436,12 @@ func TestServerDisconnect(t *testing.T) {
strmUrl := fmt.Sprintf("rtmp://localhost:%v/stream/%v", port, strm.GetStreamID())
opt := SegmenterOptions{SegLength: time.Second * 4}
vs := NewFFMpegVideoSegmenter("tmp", strm.GetStreamID(), strmUrl, opt)
server := &rtmp.Server{Addr: ":" + port}
player := vidplayer.NewVidPlayer(server, "", nil)
player.HandleRTMPPlay(
func(url *url.URL) (stream.RTMPVideoStream, error) {
return strm, nil
})

//Kick off RTMP server
go func() {
err := player.RtmpServer.ListenAndServe()
if err != nil {
t.Errorf("Error kicking off RTMP server: %v", err)
}
}()
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
cmd := "dd if=/dev/urandom count=1 ibs=2000 | nc -Nl " + port
go exec.CommandContext(ctx, "bash", "-c", cmd).Output()

err := RunRTMPToHLS(vs, ctx)
if err == nil || err.Error() != "Input/output error" {
t.Error("Expected 'Input/output error' but instead got ", err)
Expand Down
8 changes: 4 additions & 4 deletions transcoder/ffmpeg_segment_transcoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ func TestTrans(t *testing.T) {
t.Errorf("Expecting 2 output segments, got %v", len(r))
}

if len(r[0]) < 250000 || len(r[0]) > 280000 {
t.Errorf("Expecting output size to be between 250000 and 280000 , got %v", len(r[0]))
if len(r[0]) < 250000 || len(r[0]) > 285000 {
t.Errorf("Expecting output size to be between 250000 and 285000 , got %v", len(r[0]))
}

if len(r[1]) < 280000 || len(r[1]) > 310000 {
t.Errorf("Expecting output size to be between 280000 and 310000 , got %v", len(r[1]))
if len(r[1]) < 280000 || len(r[1]) > 314000 {
t.Errorf("Expecting output size to be between 280000 and 314000 , got %v", len(r[1]))
}

if len(r[2]) < 600000 || len(r[2]) > 700000 {
Expand Down