1

How do I set up a scheduled recording that stops after a set time with sound and video on 14.04? I want to record something 6 hours ahead that lasts 1 hour. It is really important that the video and sound are in top quality, and that the video quality does not decrease from the original stream. My screen is 1366x736.

I want to actually record from a m3u stream (iptv), but if that isn't possible then I can capture the screen instead.

And a question about recording the desktop if recording the m3u stream directly isn't possible: Does the audio of the pc have to be on while recording to get sound on the video?

Thanks in advance!

2 Answers2

2

One method for one-time scheduling is the at command.

  1. Enter the scheduled time:

    at 4:00 PM
    
  2. Then a prompt will appear where you enter the command to be run:

    ffmpeg -i input.m3u -c copy -t 01:00:00 output.foo
    
    • The -c copy option will enable stream copy mode which will preserve the quality because it will just re-mux instead of additionally encoding.

    • The -t 01:00:00 option will set the duration to one hour. ffmpeg will then quit after one hour.

  3. Then press ctrl+d to save the command.

If this is to be a regularly scheduled event then you could use a cronjob instead.

As for desktop recording see:

llogan
  • 11,868
0

you could use a shell script like this:

runtime_in_sec=3600
wait_time_in_sec=3600*6
sleep $wait_time_in_sec
ffmpeg <the options and the file> &  # alternatively use `avconv` instead of ffmpeg
PID=$!
sleep $runtime_in_sec
kill -9 $PID

If you wanted to set the exact hour, I would rather use a small python script or even just the ipython interpreter, because working with date and time is a lot easier. I would for example use time.monotonic() for simple calculations with seconds...