0

Suppose I have a command:

ffmpeg -f v4l2 -framerate 30 -video_size 640x480 -i /dev/video1 -c:v libx265 -x265-params bitrate=60:vbv-maxrate=60:vbv-bufsize=16:keyint=10:qcomp=0.5 -tune zerolatency -s 640x480 -preset ultrafast -pix_fmt yuv420p -r 5 -strict experimental -f somedate.ts

What I want to do is that after 30 minutes ffmpeg starts writing the stream to new file with filename as time of creation of new file.

Anakooter
  • 327
  • 4
  • 17
  • one option is to just start ffmpeg, do the recording by passing in a file "with the currentt time" then starting ffmpeg again, loop style (bash loop style) though you might lose some frames between instantiations. – rogerdpack Sep 17 '15 at 15:07
  • 1
    @rogerdpack Wouldn't it mess the start PTS? It'll reset the timestamps to (near) 0 for the next segments. – aergistal Sep 17 '15 at 15:19

1 Answers1

5

Use the segmenter instead of -f somedate.ts plus strftime:

-f segment -segment_time 1800 -strftime 1 "%Y-%m-%d_%H-%M-%S.ts

Where 1800 = 30 * 60 seconds.

aergistal
  • 29,947
  • 5
  • 70
  • 92