ffmpeg filename output format

前端 未结 6 2159
情书的邮戳
情书的邮戳 2020-12-06 00:52

When using ffmpeg to output a series of frames as images, the only format I can find documentation for is frame_%d.jpg. The %d identif

相关标签:
6条回答
  • 2020-12-06 01:12

    You can try %s with -strftime if you want to attach epoch.

    Example :

    ffmpeg -rtsp_transport tcp -i 'input.mp4' -vf fps=1 -strftime 1 "%s_frame.png"
    
    0 讨论(0)
  • 2020-12-06 01:31

    Another option you'd have would be to run ffprobe -show_packets on it, and use that data to "infer" the timestamp of each generated jpg file (assuming you generate one per incoming video frame). Yikes!

    0 讨论(0)
  • 2020-12-06 01:32

    Turns out this behavior was not yet implemented at the time.

    I implemented an initial version of %t support on my fork of FFmpeg (https://github.com/yuvadm/FFmpeg), and am currently working on cleaning up the patch so that it can be merged upstream.

    0 讨论(0)
  • 2020-12-06 01:32

    The strftime option allows you to expand the filename with date and time information. Check the documentation of the strftime() function for the syntax.

    For example to generate image files from the strftime() %Y-%m-%d_%H-%M-%S pattern, the following ffmpeg command can be used:

    ffmpeg -f v4l2 -r 1 -i /dev/video0 -f image2 -strftime 1 "%Y-%m-%d_%H-%M-%S.jpg"
    
    0 讨论(0)
  • 2020-12-06 01:34

    I hacked up a bash script that creates file names based on time into the film. It uses a format: "hh_mm_ss" in the file name. You can see it at:

    https://github.com/pozar/makemoviethumbs

    0 讨论(0)
  • 2020-12-06 01:35

    For number of frames can use report with special debug mode:

    FFREPORT=file=\'file.log\':level=48 && ffmpeg ... -vf select=eq(pict_type\,PICT_TYPE_I) -vsync vfr -f image2 OUTPUT
    

    then you can match the name with preg_match_all:

    preg_match_all("/] n:(\\d+)\\.[^>]+pict_type:I/Us",$log,$m,PREG_PATTERN_ORDER,5000);
    $frames=$m[1];
    

    Please enjoy!

    0 讨论(0)
提交回复
热议问题