auto-adjust MP4 encoding setting for a second video to those of first video?

Started by thoste, January 26, 2024, 02:29:30 PM

Previous topic - Next topic

thoste

Occasionally I got .mp4 videos which belong to the same topic but have (slightly) different height/width dimension.
I want to join/concatenate them anyway.
Unfortunately AD has no feature "concatenate and re-encode parts (only) if necessary"

So I have to do it manually.
In order not to fiddle out the necessary parms (width, height, bitrate ??) I can think of a feature "Copy encoding parameters from first video aaa.mp4 to the encoding setup of second video bbb.mp4".

Is there such a feature?

Which parameters do I have to adjust maximally ? Is same height/width sufficient to concatenate two .mp4?
Or are more parameters to be the same (bitrate, fps,keyframe interval.....)?

eumagga0x2a

Quote from: thoste on January 26, 2024, 02:29:30 PMIs there such a feature?

No, and in general AFAIK not feasible with modern codecs. There are some exceptions like x264 and x265 encoders optionally injecting a SEI message into the video stream containing info about encoder version and configuration used to produce the stream. Or if you have encoded the first video yourself and know all the details beforehand.

Quote from: thoste on January 26, 2024, 02:29:30 PMWhich parameters do I have to adjust maximally ?

If the goal is to avoid re-encoding the whole video, the video codec extradata of appended video (the one which needs to be re-encoded anywhay) must match extradata of the first video perfectly.

Quote from: thoste on January 26, 2024, 02:29:30 PMIs same height/width sufficient to concatenate two .mp4?
Or are more parameters to be the same (bitrate, fps,keyframe interval.....)?

To concatenate with re-encoding, matching dimensions are mandatory and matching fps strongly recommended.

To concatenate in copy mode, as I already told you, the codec extradata (an instruction for the decoder how to interpret the bitstream) and thus also all properties must match perfectly – every single bit.