-1

I'm gonna make a converter to h.265 with ffmpeg, based on documentation: http://www.ffmpeg.org/doxygen/trunk/transcoding_8c-example.html I want to add info about the progress, but I have no idea what number I can use to show that, for example in %. Please help. :)

Twenkid
  • 825
  • 7
  • 15

1 Answers1

0

What about offering several variants with a choice with an argument? I think time passed and the estimated time left are more suggestive for than % - for example in order to leave the machine or the window to work and return to check it later.

Also, the current frame rate of the conversion is suggestive, it gives hints eventually for adjusting the bitrate etc. if it's too slow.

So you may measure the time of the encoding so far and try to estimate the frame rate of processing and how much remains.

ffmpeg itself displays current time or current frame from the processed video and the duration of the video.

Twenkid
  • 825
  • 7
  • 15
  • Thanks for answer :) You'r suggestion are good, but i want % because in the end i want to make progress bar. For example - relation between current time/duration will be good, or current frame/number of frames. As far i know, it's impossible to get 'number of frames' of video stream in ffmpeg. So i can make it by current time, but i have a problem how to get this number during encoding process. – BloodyFerret Jan 07 '21 at 17:11
  • IMO this is another question, not what units to use as posed, but how to do it with the sample code. You can make a progress bar either. In main: while (ret >= 0) { ret = avcodec_receive_frame(stream->dec_ctx, stream->dec_frame); (...) ret = filter_encode_write_frame(stream->dec_frame, stream_index); if (ret < 0) goto end; } Count the frames. One way to get the duration (if you can't find a function in the headers) is to call the command line of ffmpeg or ffprobe and sample the output. – Twenkid Jan 07 '21 at 21:19