[Ffmpeg-devel] "cutting" bug: invalid backstep
Cyrus A
lists
Sat Nov 4 04:32:37 CET 2006
Victor P and I have discovered a bug in the way ffmpeg crops a file with
a combination of "-ss" and "-t" switches. When recording an avi with
mpeg4 and mp3 (other codecs may be affected, too -- I just haven't
tested them), and then using ffmpeg to cut out a portion, something is
wrong with the resulting "chopped" file.
First, a command to retrieve still frames from the segment failed by
only creating one still frame instead of the specified number.
Second, (I just found out a few minutes ago) ffmpeg craps out with an
"invalid backstep" error when trying to reencode the chopped file.
Victor discovered that by piping the chopped file into ffmpeg, you can
get the still frames to generate and I just discovered that the same is
true for reencoding (i.e. that piping it in is a workaround).
Here are the associated commands:
long input file generated with:
ffmpeg -v 0 -i /dev/video0 -async 1 -y -vcodec mpeg4 -acodec mp3 -t 1780
-b 1750k -ab 192 -s 480x384 -r ntsc -vtag DX50 'long_input_file.avi'
"cut" command:
ffmpeg -ss 180 -t 60 -y -vcodec copy -acodec copy -i long_input_file.avi
short_output_file.avi (seems to work ok)
still frames generation:
ffmpeg -i short_output_file.avi -r 1 -f image2 frame%03d.jpg (only
generates the first frame)
reencoding:
ffmpeg -v 0 -b 600 -y -i short_output_file.avi short_output_file.mpg
(invalid backstep -- console output below)
still frames workaround:
cat short_output_file.avi | ffmpeg -i - short_output_file.avi -r 1 -f
image2 frames%03d.jpg
reencode workaround:
cat short_output_file.avi | ffmpeg -v 0 -b 600 -y -i -
short_output_file.mpg
failed re-encode console output:
FFmpeg version SVN-r6849, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --enable-mp3lame
libavutil version: 49.0.2
libavcodec version: 51.23.0
libavformat version: 50.6.0
built on Oct 31 2006 12:55:14, gcc: 4.1.1 20060525 (Red Hat 4.1.1-1)
Seems that stream 0 comes from film source: 30000.00 (30000/1) -> 29.97
(30000/1001)
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
backstep:125, lastbuf:0
invalid new backstep 591
frame= 1 q=6.1 Lsize= 30kB time=0.0 bitrate=9408.1kbits/s
video:26kB audio:0kB global headers:0kB muxing overhead 13.798852%
I think I'm good to go with what I need to do using the work arounds,
but I thought everyone might like to know about this bug.
Cyrus
p.s. For more information, read the thread titled "cutting a file and
getting still images"
More information about the ffmpeg-devel
mailing list