[Ffmpeg-devel] seek with duration for cutting: broken or changed?
Cyrus A
lists
Wed Nov 1 19:45:30 CET 2006
Michael Niedermayer wrote:
> Hi
>
> On Mon, Oct 30, 2006 at 05:37:25PM -0500, Cyrus A wrote:
>
>> Michael Niedermayer wrote:
>>
>>> Hi
>>>
>>> On Mon, Oct 30, 2006 at 12:55:16PM -0500, Cyrus A wrote:
>>>
>>>
>>>> The following command used to work to cut a specific segment out of a
>>>> video file on some FC3 machines I'm using with an old version of ffmpeg
>>>> (still does work):
>>>>
>>>> ffmpeg -acodec copy -vcodec copy -i fullvideo.avi -ss 60 -t 120
>>>> choppedvideo.avi
>>>>
>>>> But it doesn't work anymore with Fedora Core 5 on a 64-bit machine
>>>> running today's SVN copy of ffmpeg. (Also doesn't work with freshrpms
>>>> latest ffmpeg rpm, either.) I believe what it's doing is seeking, but
>>>> the duration is completely ignored. It just returns the rest of the file
>>>>
>>> >from where the seek took it. The resulting file is also a little
>>>
>>>> "chirpy" -- the audio video sync is messed up somehow.
>>>>
>>>>
>>> could you find out when this problem was introduced into svn (see
>>> binary search and svn up -r)
>>>
>>> [...]
>>>
>>>
>>>
>> Found it. The seek + duration option worked normally through revision
>> 4526 and then stopped working in 4527 and every other revision
>> thereafter. It was August 15th, 2005.
>>
>> The change notes read:
>>
>> parse pict_type for streams in avi
>> fix mpeg4 parser so it outputs te pict_type
>> support header only parseing without repacking
>>
>> That's interesting since I'm using mpeg4 for my vcodec and producing an
>> AVI file.
>>
>> Man, binary searching like that is not fun. Please let me know what you
>> think.
>>
>
> i think ive just fixed it ...
>
> [...]
>
Ok, that helped. The "ffmpeg -i input.avi -acodec copy -vcodec copy -ss
5 -t 10 output.avi" command no longer churns as before. The cut is very
quick and look as if it worked. But it doesn't. Here are the various
commands I used for some tests: ("old" means 0.4.8 ffmpeg-era on 32-bit
machines):
6849 rec: ffmpeg -i /dev/video0 -async 1 -y -vcodec mpeg4 -acodec mp3 -t
30 -b 1750k -ab 192 -ar 44100 -s 480x384 test.avi
old rec: ffmpeg -r ntsc -vd /dev/video0 -ad /dev/audio -vcodec mpeg4
-acodec mp3 -y -s 480x384 -b 1750 -t 30 test.avi
6849 cut: ffmpeg -i test.avi -acodec copy -vcodec copy -y -ss 5 -t 20
test_cut.avi
old cut: ffmpeg -i test.avi -acodec copy -vcodec copy -y -ss 5 -t 20
test_cut.avi
6849 cut reenc: ffmpeg -i test.avi -acodec mp3 -vcodec mpeg4 -y -ss 5 -t
20 test_cut.avi
old cut reenc: ffmpeg -i test.avi -acodec mp3 -vcodec mpeg4 -y -ss 5 -t
20 test_cut.avi
Here is the 2x3 results table:
oldcopy 6849copy 6849reenc <-- cut
with this version
old OK aud b4 vid no audio at all
6849 aud b4 vid *aud b4 vid* OK
^---- recorded with this version
*= this is the one I need to work
So if I record on the old version and copy-cut with the old version, it
works. Ditto the 6849 revision when reencode cut with -acodec mp3 and
vcodec mpeg4. Problem is, the old version won't compile on my 64 bit
machine under FC5 (common.h: incompat element type) and the new version
won't do a copy cut. A reencode cut doesn't help me because it takes
forever for big files. These cuts have to be quick for web application use.
An interesting note I found was that for those that have "audio before
video" the audio is exactly 5 seconds before the video. So, I tried -ss
2 and, whammo, the audio was only 2 seconds before the video. Likewise,
-ss 8 made the audio 8 seconds before the video. Obviously, this is the
problem.
If anyone can help me get syncd files from a "cut" process, I would
really really appreciate it.
Cyrus
More information about the ffmpeg-devel
mailing list