2

I want to convert video to images, do some image processing and convert images back to video.

Here is my commands:

./ffmpeg -r 30 -i $VIDEO_NAME "image%d.png"

./ffmpeg -r 30 -y -i "image%d.png" output.mpg

But in output.mpg video I have some artefacts like in jpeg.

Also I don't know how to detrmine fps, I set fps=30 (-r 30). When I use above first command without -r it produces a lot of images > 1kk, but than I use -r 30 option it produce same number of images as this command calculationg number of frames:

FRAME_COUNT=`./ffprobe -v error -count_frames -select_streams v:0 -show_entries stream=nb_read_frames -of default=nokey=1:noprint_wrappers=1 $VIDEO_NAME`

So my questions are:

  1. How to determine frame rate ?

  2. How to convert images to video and don't reduce initial quality?

UPDATE:

Seems this helped, after I removed -r option Image sequence to video quality

so resulting command is :

./ffmpeg -y -i "image%d.png" -vcodec mpeg4 -b $BITRATE output_$BITRATE.avi

but I'm still not sure how to select bitrate.

How can I see bitrate of original .mp4 file?

Community
  • 1
  • 1
mrgloom
  • 20,061
  • 36
  • 171
  • 301

1 Answers1

2

You can use the qscale parameter instead of bitrate e.g.

ffmpeg -y -i "image%d.png" -vcodec mpeg4 -q:v 1 output_1.avi

q:v is short for qscale:v. 1 may produce too large files. 4-6 is a decent range to use.

Gyan
  • 85,394
  • 9
  • 169
  • 201