[FFmpeg-user] questions about audio filter "atempo"

Pavel Koshevoy pkoshevoy at gmail.com
Wed Jul 18 08:33:19 CEST 2012


On 7/17/2012 11:35 PM, Pavel Koshevoy wrote:
> On 7/17/2012 9:58 PM, 韩瑞松 wrote:
>> Why did I get a "Segmentation fault"?
>> I used this command line:
>> ffmpeg -y -i youku.mp4 -analyzeduration 2G -vcodec libx264 -b 512k -r 
>> 25 -s 576x312 -aspect 576:312 -psnr -acodec libfaac -ab 64k -ar 44100 
>> -ac 2 -vf 
>> "movie=2.jpg,scale=100:100[logo];[in][logo]overlay=5:5[out]" -af 
>> atempo=2 -f flv -map_chapters -1 -g 50 youku.mp4.flv
>> it's output:
>
> A stack trace would be helpful.
>
> When you set atempo=2 you double the audio playback rate and cut down 
> the soundtrack duration in half. However, this does not affect the 
> video track. You need to adjust the video track rate to match the 
> audio track.
>
> I haven't tried this myself, but you probably need to use setpts 
> filter for the video track (try setpts=0.5*PTS).
>
> http://ffmpeg.org/trac/ffmpeg/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video 
>
> http://ffmpeg.org/ffmpeg.html#setpts
>
> Pavel.
>


I tried and could not reproduce the segfault with zeranoe 32-bit static 
ffmpeg build from 20120716.

I tried without setpts first:  ffmpeg -y -i test2.avi -vcodec libx264 -b 
512k -r 25 -s 576x312 -aspect 576:312 -psnr -acodec libvorbis -ab 64k 
-ar 44100 -ac 2 -af atempo=2 test2.mkv

This did not crash, but I could see the memory footprint of ffmpeg climb 
from 94MB to 146MB.  Without setpts audio/video were out of sync, 
obviously.  I suspect the muxer buffers up frames to compensate for 
mismatched audio/video PTS rates.  If the video is long and the frames 
are large this could cause and out-of-memory error.  In my test the 
source file was 24min 30sec long.

Anyway, when I added  -vf "setpts=0.5*PTS" I did not see the crash 
either, audio/video came out in sync, and ffmpeg memory footprint stayed 
pretty flat at 94-95MB.

     Pavel.



More information about the ffmpeg-user mailing list