[FFmpeg-user] Slowing ffmpeg down
Shaun Procter
shaun.procter at gmail.com
Thu Aug 13 10:07:56 EEST 2020
> On 13 Aug 2020, at 2:35 am, Rich Andrews <stuart.r.andrews at gmail.com> wrote:
>
> On Tue, Aug 11, 2020 at 11:54 PM Shaun Procter <shaun.procter at gmail.com <mailto:shaun.procter at gmail.com>>
> wrote:
>
>>> On 12 Aug 2020, at 9:01 am, Rich Andrews <stuart.r.andrews at gmail.com>
>> wrote:
>>>
>>> Is there any trick to slow down ffmpeg on a simple stream mapping?
>>>
>>> Stream mapping:
>>> Stream #0:0 -> #0:0 (pcm_s16le (native) -> pcm_s16le (native))
>>>
>>> Given an input file that is looped and output with a command such as:
>>>
>>> ffmpeg-4.2.1-armhf-static/ffmpeg -y -t 200 -stream_loop -1 -i
>> HoldMusic.wav
>>> -map 0:a:0 -f wav output.wav
>>>
>>> ffmpeg can move the data really quickly!
>>>
>>> bitrate=1411.2kbits/s speed= 262x
>>>
>>> Any way to get that speed down to ~1x? My purpose is that ffmpeg is
>> being
>>> used as a child subprocess and I would like to be able to test its
>> behavior
>>> in-situ. There is a lot of timing in my application between fork and
>> join
>>> and having ffmpeg be slow would be really helpful.
>>>
>>> Push comes to shove, I'll just use another program to more slowly copy,
>> but
>>> that wouldn't be as good as using ffmpeg itself since it has a host of
>>> behaviors as a child process regarding signaling and return codes. Come
>> to
>>> think of it, since I built ffmpeg, maybe I can just build a variant that
>>> sleeps frequently?
>>>
>>
>> You can use the -re flag like this,
>>
>> ffmpeg-4.2.1-armhf-static/ffmpeg -re -y -t 200 -stream_loop -1 -I
>> HoldMusic.wav -map 0:a:0 -f wav output.wav
>>
>> “The FFmpeg's "-re" flag means to "Read input at native frame rate. Mainly
>> used to simulate a grab device." i.e. if you wanted to stream a video file,
>> then you would want to use this, otherwise it might stream it too fast (it
>> attempts to stream at line speed by default). My guess is you typically
>> don't want to use this flag when streaming from a live device, ever.” -
>> https://trac.ffmpeg.org/wiki/StreamingGuide
>>
>> Hope that helps.
>>
>> Shaun
>>
>>
> I feel silly for having looked at that very switch and didn't bother trying
> it thinking that the input file doesn't have a framerate. '-re' works
> perfectly. Thank you for the perfect solution!
No worries at all, am glad I could help. It’s definitely not silly and we all need to start somewhere. The main thing is you asked for help and that shows intelligence.
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org <mailto:ffmpeg-user at ffmpeg.org>
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user <https://ffmpeg.org/mailman/listinfo/ffmpeg-user>
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org <mailto:ffmpeg-user-request at ffmpeg.org> with subject "unsubscribe".
More information about the ffmpeg-user
mailing list