1

I am trying to extract png images from a video using ffmpeg and add the timestamp as a part of the generated image file name.

Please see the below command I am using for the same

ffmpeg -vcodec mpeg2video -f mpegts -i test_movie.ts -f image2 -vf "drawtext=fontfile=/Library/Fonts/Tahoma.ttf: timecode='$(date +%H\\:%M\\:%S).00': r=30: x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000000@1" -vsync vfr -pattern_type glob ./compare_multiple_$(gdate +%H\_%M\_%S_%3N).png

But this is not appending the filename properly. It gives an error as shown below:

[image2 @ 0x7ff01301f600] Could not get frame filename number 2 from pattern './compare_multiple_10_09_58_490.png' (either set updatefirst or use a pattern like %03d within the filename pattern) av_interleaved_write_frame(): Invalid argument frame= 10 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.12 bitrate=N/A video:1047kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Conversion failed!

0

You were close, but the problem is pointed to right from the error message: Your pattern ./compare_multiple_$(gdate +%H\_%M\_%S_%3N).png is incorrect.

In the documenation, when they use "N" in the pattern, "N" is symbolic for the 'integer of your choosing', and in your case, it looks like you want that to be 3. So use %3d instead of %3N and you should be good to go.

  • Did you try doing this and did it work? – Sen Nov 2 '15 at 9:21
  • No. I read your error message, and then I read the documentation. An error message well written software rarely lies. The trick is usually just in interpreting it. – Dale Anderson Nov 2 '15 at 9:30
  • Okk. Yup, I have tried this. It doesn't work. – Sen Nov 2 '15 at 9:34
  • 1
    And? Was the error message the same? Or did you get a different one? – Dale Anderson Nov 2 '15 at 9:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.