[FFmpeg-user] Transcode with the some properties

Moritz Barsnick barsnick at gmx.net
Mon Nov 4 18:23:01 EET 2019

Hi Boris,

On Mon, Nov 04, 2019 at 10:29:10 +0100, Boris wrote:
> Hello,
> I want to transcode video with exactly the same properties of the input
> video in the output video.
> I use the transcoding.cc code. In the static int open_output_file(const
> char *filename) function, I set  encoder parameters like this :

This list (ffmpeg-users) is primarily for the use of the command line
tool. For assistance with programming with the libav* libraries, please
refer to the mailing list libav-user:

Also please note that your code was wrapped in a fashion making it hard
to read:


You may want to avoid line breaks in your mailer, or attach a text file instead.

> But when I run exiftool on output  video and on input video, some values
> like video duration, encoder, bit rate,  are differente.
> Can someone tells me how can I do to keep the same parameters (metada) of
> the input video in the output video, please?

What are you exactly trying to achieve? If you want *exactly* the same
characteristics, you should probably just copy the stream (and the
metadata) instead of re-encoding.

Duration and bitrate are not metadata.

The encoder (metadata) will be different, because it is a different
encoder. ;-) You can manipulate the metadata though.

If you correctly determine the source's bitrate, you should be able to
set it for the encoding, and depending on the encoder, you may achieve
the exact same rate.

But the input stream may have more characteristics, such as:
- VBR,
- GOP size, or even
- placement of I-frames,
- use of B-frames
and so on. Which of these do you want to duplicate, which not? And why?

If you specify your actual needs more precisely, it may be easier to
come up with a recipe to fulfill them. On the other list, of course.


More information about the ffmpeg-user mailing list