FFMPEG:segment fromat add timestamp into filename option

原本只能輸出成 %4d.mp4 ==> 0000.mp4, 0001.mp4
要改成可以像行車紀錄器般的檔案格式 201405020248.mp4

增加 %t 的參數
ffmpeg -i input -f segment -segment_time 60 -reset_timestamps 1 %t.mp4

這邊將 %t.mp4 定義成 Webcam年日月/E年日月時分秒.mp4
strftime(buf1, sizeof(buf1), “WebCam%Y%m%d/E%Y%m%d%H%M%S”, localtime(&tv.tv_sec));

修改方式如下:

修改 ffmpeg source / libavformat / utils.c 檔案
增加引用 #include <sys/time.h>

尋找 av_get_frame_filename function
替換成下面這一個

This entry was posted in FFMpeg. Bookmark the permalink.