Log in

View Full Version : Encode video with the same properties of another video


Kyaneos
24th May 2020, 02:05
Hello!

I need to encode a video (video 1) that has the same properties of another video (video 2) so that I can join both with mkvtoolnix.

This is the mediainfo of video 2:

Vídeo
ID : 2
Formato : AVC
Formato/Info : Advanced Video Codec
Formato del perfil : High@L4
Ajustes del formato : CABAC / 4 Ref Frames
Ajustes del formato, CABAC : Sí
Ajustes del formato, RefFrames : 4 fotogramas
ID códec : V_MPEG4/ISO/AVC
Duración : 32 s 32 ms
Tipo de tasa de bits : Constante
Tasa de bits : 7 993 kb/s
Tasa de bits nominal : 10 000 kb/s
Ancho : 1 920 píxeles
Alto : 816 píxeles
Relación de aspecto : 2,35:1
Modo velocidad fotogramas : Constante
Velocidad de fotogramas : 23,976 (24000/1001) FPS
Espacio de color : YUV
Submuestreo croma : 4:2:0
Profundidad bits : 8 bits
Tipo barrido : Progresivo
Bits/(píxel*fotograma) : 0.213
Tamaño de pista : 30,5 MiB (93%)
Default : Sí
Forced : No
Rango de color : Limited
Colores primarios : BT.709
Características transferencia : BT.709
Coeficientes matriz : BT.709

A sample from the video 2:

https://mega.nz/file/GRhkmADD#IXyIq2a_sCEHiDM0jYCsBzyQ2GOQgSqpzt-5twe6mFM

I have tried different options to encode video 1 in x264, trying to make them the same as the video 2, but when trying to join them mkvtoolnix gives error ("the formats do not match")

Any ideas?, my main objective is not to recode the video 2.

Thanks in advance!

sneaker_ger
24th May 2020, 07:11
I have tried different options to encode video 1 in x264, trying to make them the same as the video 2, but when trying to join them mkvtoolnix gives error ("the formats do not match")
Take a closer look at the error message. It should tell you which tracks it tried to append. The message "formats do not match" is not about two H.264 tracks with different settings but e.g. you trying to append a video track to an audio track. Fix your command line (see mkvmerge doc about --append-to option or use the GUI). Use mkvmerge -i "file.mkv" to see TrackIDs as used by mkvmerge, not MediaInfo.

Kyaneos
24th May 2020, 15:14
Take a closer look at the error message. It should tell you which tracks it tried to append. The message "formats do not match" is not about two H.264 tracks with different settings but e.g. you trying to append a video track to an audio track. Fix your command line (see mkvmerge doc about --append-to option or use the GUI). Use mkvmerge -i "file.mkv" to see TrackIDs as used by mkvmerge, not MediaInfo.

Thank you very much, now it works! :thanks:

One last question, the video 2 has a DAR of 959:408, what fraction do I have to use in the --sar parameter of the encoding of video 1 to get the same DAR of video 2?

Remember that the resolution of both videos is 1920x816.

Thanks!

sneaker_ger
24th May 2020, 15:23
Your sample has SAR of 799:800.

Kyaneos
8th July 2020, 22:56
Thank you very much, now it works! :thanks:

One last question, the video 2 has a DAR of 959:408, what fraction do I have to use in the --sar parameter of the encoding of video 1 to get the same DAR of video 2?

Remember that the resolution of both videos is 1920x816.

Thanks!

I thought it worked because mkvtoolnix finished the job but checking the resulting video there are color issues (constant changes).

Looking at the mkvtoolnix log I found this:

--- Warnings emitted by job Multiplexing to file...
The track number 0 from the file 'Part 2.mkv' can probably not be appended correctly to the track number 0 from the file 'Part 1.mkv': The codec's private data does not match (lengths: 61 and 44). Please make sure that the resulting file plays correctly the whole time. The author of this program will probably not give support for playback issues with the resulting file. "

Does anyone know how I could fix it?