2

In the process of creating a preview of what ffmpeg, is streaming i came up with this command:

ffmpeg -i colony.mkv -c:v libx264 -f mpegts udp://127.0.0.1:1234 -vf fps=1 -s 320x240 d:\preview\out%d.jpg

This is great, but it is outputting to a series of image files that are difficult to track:out1.jpg, out2.jpg ... etc...

When i remove the %d parameters, it throws an error saying

[image2 @ 00000162c6a3d840] Could not get frame filename number 2 from pattern 'd:\preview\out.jpg' (either set update or use a pattern like %03d within the filename pattern)
av_interleaved_write_frame(): Invalid argument

Is there a way to do this please?

2

You have to use the update option.

-vf fps=1 -s 320x240 -update 1 d:\preview\out.jpg

This will rewrite onto the same file.

To avoid a possible read op in the middle of the updating, you can add -atomic_writing 1

3
  • Sorry to bother you again .. But with this command when i put a logo (an overlay) it stops generating the preview image any specific reason ?? i am using a filter_complex to overlay the logo as i am using a subtitle also and a banner .. but with everything the preview works except when i use the logo overlay .. it stops generating the preview or the second output
    – Tony Hanna
    Jun 7 '18 at 15:50
  • Open a new Q with the new command
    – Gyan
    Jun 7 '18 at 16:25
  • i did .. just did
    – Tony Hanna
    Jun 7 '18 at 16:37

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.