#8014 closed defect (invalid)
Piping mjpeg drops frames
Reported by: | Sig | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
It seems switching output from jpeg image files to a pipe results in frames not being outputted to the pipe.
Attached is 100-frames.mp4 which is a video of 100 sequentially numbered frames.
As expected running the below outputs all 100 frames correctly.
ffmpeg -i 100-frames.mp4 -f image2 -vcodec mjpeg "out%05d.jpg"
However running this next command results in only 53 frames being detected:
ffmpeg -i 100-frames.mp4 -f image2 -vcodec mjpeg -update 1 pipe:1 | xxd | grep "ffd8" | wc -l
This one uses xxd to convert the outputted binary into hex then uses grep to search for the jpeg start bytes ("ffd8"). Finally wc counts the search hits and prints the total at the end. So the number output at the end is the number of JPEGs seen in the stream.
Attachments (3)
Change History (7)
by , 5 years ago
Attachment: | 100-frames.mp4 added |
---|
by , 5 years ago
Attachment: | ffmpeg-20190712-195906-write-images-to-file.log added |
---|
output from -report
by , 5 years ago
Attachment: | ffmpeg-20190712-200111-write-image-to-pipe.log added |
---|
output from -report
comment:2 by , 5 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
- Your video actually contains 101 frames.
- You have not really shown that this is a bug in FFmpeg. It could also be in your other software or in your handling of the other software.
- It is actually your handling of the other software. The output of xxd looks like this:
00000000: ffd8 ffe0 0010 4a46 4946 0001 0200 0001 ......JFIF...... 00000010: 0001 0000 fffe 0010 4c61 7663 3538 2e35 ........Lavc58.5 00000020: 332e 3130 3100 ffdb 0043 0008 0808 0908 3.101....C......
The ffd8 at the beginning will of course be found by grep. But this non-word-aligned occurence will not:0000bf90: 0c88 bad3 4591 65bf ebd6 0b42 e188 5865 ....E.e....B..Xe 0000bfa0: 6e9f 0877 4dd7 a2ff d9ff d8ff e000 104a n..wM..........J 0000bfb0: 4649 4600 0102 0000 0100 0100 00ff fe00 FIF.............
This happens 41 times; and there are a further eight times where ff and d8 are in different lines. 41 + 8 + 52 = 101; notice that one of your 53 matches is actually a false match:000ffd80: 19a1 1985 04e0 8ad4 d3c5 4944 7074 0386 ..........IDpt..
comment:3 by , 5 years ago
Thanks, I see where I've gone wrong now.
Very much appreciate the thorough (and prompt!) response.
comment:4 by , 5 years ago
Component: | ffmpeg → undetermined |
---|---|
Keywords: | h264 mjpeg pipe dropped frames removed |
Sample video containing 100 frames