I am subscribing to an input stream from tvheadend using ffmpeg and I am writing that stream to disk continuously . I'd like to limit this output stream so that there are 10 megabytes of data stored at maximum at any time.
I already looked into sponge from moreutils and the linux buffer command to build some kind of a pipe . Though, I could not find a working solution yet. Who can point me into the right direction?
Use the -t option to specify a time limit: `-t duration' Restrict the transcoded/captured video sequence to the duration specified in seconds. hh:mm:ss[. xxx] syntax is also supported.
ffmpeg is a command-line tool that converts audio or video formats. It can also capture and encode in real-time from various hardware and software sources such as a TV capture card. ffplay is a simple media player utilizing SDL and the FFmpeg libraries.
You need just -fs
key.
It sets output filesize limit in bytes.
You can type ffmpeg -i input -fs 10M -c copy output
, where input
is your input address, output
- filename you want your file to have. M
specifies that you want size in megabytes (also k
for kilobytes is allowed).
For overwriting you can use a small sript like this
#!/bin/bash
t=1
while :
do
ffmpeg -i input -fs 10M -c copy output$t
t=`expr $t + 1`
done
I think this is more elegant than trying to do everything using ffmpeg only.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With