Slowing ffmpeg down

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Slowing ffmpeg down

Rich Andrews
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?

Thanks for any clever ideas!
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Slowing ffmpeg down

Shaun Procter


> On 12 Aug 2020, at 9:01 am, Rich Andrews <[hidden email]> 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?
>
> Thanks for any clever ideas!
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe”.

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

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Slowing ffmpeg down

Rich Andrews
On Tue, Aug 11, 2020 at 11:54 PM Shaun Procter <[hidden email]>
wrote:

> > On 12 Aug 2020, at 9:01 am, Rich Andrews <[hidden email]>
> 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!
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Slowing ffmpeg down

Shaun Procter


> On 13 Aug 2020, at 2:35 am, Rich Andrews <[hidden email]> wrote:
>
> On Tue, Aug 11, 2020 at 11:54 PM Shaun Procter <[hidden email] <mailto:[hidden email]>>
> wrote:
>
>>> On 12 Aug 2020, at 9:01 am, Rich Andrews <[hidden email]>
>> 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
> [hidden email] <mailto:[hidden email]>
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user <https://ffmpeg.org/mailman/listinfo/ffmpeg-user>
>
> To unsubscribe, visit link above, or email
> [hidden email] <mailto:[hidden email]> with subject "unsubscribe".

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".