#7379 closed defect (fixed)
Matroska regression after ff_isom_write_avcc() changes
Reported by: | Andrii | Owned by: | |
---|---|---|---|
Priority: | important | Component: | avformat |
Version: | git-master | Keywords: | h264 regression |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description
Summary of the bug:
I have found the issue after moving from ffmpeg version 3.4.1 to 4.0.2.
I use ffmpeg to grab video from USB camera.
I use codec copy flag to just avoid video transcoding.
Saving stream into matroska container worked fine on ffmpeg 3.4.1, but on 4.0.2 it is failed with following error - "Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input".
I have saved the stream into flv container. Attempt to save this flv to mkv is failed with the same error.
I have made my own investigation and figured out that the issue it related to changes in ff_isom_write_avcc() call. In 4.0.2 it returns error if data size is zero, while on ffmpeg 3.4.1 it returns 0. So I have created the patch to just ignore that error for now.
Anyway I should understand that is regression, or maybe my camera generates some unsupported/inconsistent stream format?
Thanks a lot for your support.
How to reproduce:
$ ./ffmpeg.exe -v trace -i matroska_and_ff_isom_write_avcc.flv -vcodec copy test.mkv > matroska_and_ff_isom_write_avcc.log 2>&1
Attachments (4)
Change History (10)
by , 6 years ago
Attachment: | matroska_and_ff_isom_write_avcc.flv added |
---|
by , 6 years ago
Attachment: | matroska_and_ff_isom_write_avcc.log added |
---|
comment:1 by , 6 years ago
Keywords: | regression added; mkv ff_isom_write_avcc removed |
---|---|
Priority: | normal → important |
Reproduced by developer: | set |
Status: | new → open |
Version: | unspecified → git-master |
comment:2 by , 6 years ago
You can't write avcC data to CodecPrivate without at least an sps in AVCodecParameters->extradata. And without it you get invalid output.
Either the flv source is broken, or the flv demuxer broken. I see this file reports an extradata of size 0. It should instead not try to set extradata at all in that case and let libavformat generic code handle it.
comment:3 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | open → closed |
Should be fixed in 701aca55fd1186e440a5b208374d4754c9181f80
by , 6 years ago
Attachment: | matroska_and_ff_isom_write_avcc.mkv added |
---|
by , 6 years ago
Attachment: | matroska_and_ff_isom_write_avcc_v4l2.log added |
---|
comment:4 by , 6 years ago
I do not understand how your fix should help.
As I understand main issue is related to no extradata in codec parameters on input h264 stream.
I attached flv file just for example.
Main issue is when I read v4l2 device and have same error as on example flv:
$ ffmpeg -v trace -f v4l2 -i /dev/video1 -vcodec copy -t 2 matroska_and_ff_isom_write_avcc.mkv > matroska_and_ff_isom_write_avcc_v4l2.log 2>&1
Please, take a look into new attachment.
comment:5 by , 6 years ago
The example to reproduce the issue you mentioned in the ticket was using an flv as source to remux into matroska. That's what i fixed.
Muxing h264 streams into Matroska without filling CodecPrivate is not allowed. It wouldn't generate valid files, and that's why the behavior of ff_isom_write_avcc() was changed.
Regression since ae7df68edd79bce5c318810c6b307ee4e81cd2a6