libav - save (segmented) stream capture with timestamp in file name

Asked

Viewed 31 times

1

I was looking on the internet to make a home DVR (using a Linux machine) and what I found was this avconv command:

avconv -i rtsp://<user>:<password>@xxx.xxx.xxx.xxx:xxx/play1.sdp -c copy -map 0 -f segment -segment_time 300 -segment_format mp4 "capture-%03d.mp4"

However, as seen in the command, the default file name is sequential (capture-001.mp4) and I need the name with the date and time (capture-12-08-2017_15-54.mp4), and searching the libav documentation apparently only this sequential option is possible.

I wonder if it is possible using only avconv and bash (if yes how to do it), or otherwise which tools I need.

Grateful from now on.

1 answer

1


As discussed in the English version of this question, a user recommended me to change pro ffmpeg which already has an attribute supporting timestamp, so I got what I needed with this command:

ffmpeg -i rtsp://<user>:<password>@xxx.xxx.xxx.xxx:xxx/play1.sdp -c copy -map 0 -f segment -strftime 1 -segment_time 1800 -segment_format mp4 out-%d_%m_%Y-%H_%M_%S.mp4

Browser other questions tagged

You are not signed in. Login or sign up in order to post.