Skip to content

Commit

Permalink
Merge pull request #5 from Arimeka/fix-ffmpeg-streams-parsing
Browse files Browse the repository at this point in the history
FIX: Empty streams in video/audio causes segmentation violation
  • Loading branch information
Arimeka committed Jan 31, 2020
2 parents c815135 + b36df4d commit bfc4fab
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ffprobe.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ func (info *Info) FFProbe() error {
}

codecCtx := stream.CodecCtx()
if codecCtx == nil {
// do nothing if can't extract codec from stream
continue
}
codec := codecCtx.Codec()

streamInfo := Stream{
Expand Down
1 change: 1 addition & 0 deletions ffprobe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

var bitrateFiles = map[string]int64{
"./fixtures/video.mp4": 551193,
"./fixtures/with-meta.mov": 481140,
"./fixtures/audio.mp3": 128000,
"./fixtures/not-a-video.mp4": 0,
"./fixtures/corrupted.mp4": 0,
Expand Down
Binary file added fixtures/with-meta.mov
Binary file not shown.

0 comments on commit bfc4fab

Please sign in to comment.