Log in

View Full Version : Duplicating exact mpeg2 encoding settings for remuxing


Adam Cole
24th March 2020, 13:13
I have a video (lets call it video 1) that I want to append to another video (lets call it video 2). Video 2 has the following mediainfo:

Video
ID : 1
Format : MPEG Video
Format version : Version 2
Format profile : Main@Main
Format settings, BVOP : Yes
Format settings, Matrix : Custom
Format settings, GOP : Variable
Codec ID : V_MPEG2
Codec ID/Info : MPEG 1 or 2 Video
Duration : 22 min 19 s
Bit rate mode : Variable
Bit rate : 7 067 kb/s
Maximum bit rate : 9 800 kb/s
Width : 720 pixels
Height : 480 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) FPS
Standard : Component
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Scan order : 2:3 Pulldown
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.853
Time code of first frame : 01:02:02:05
Time code source : Group of pictures header
Stream size : 1.10 GiB (94%)
Language : English
Default : No
Forced : No
Color primaries : BT.601 NTSC
Transfer characteristics : BT.601
Matrix coefficients : BT.601

I want to encode video 1 so that it has the exact same mediainfo. Then the plan is to append it on video 2 using MKVtoolNix.

I tried a number of encode settings but during the remux process, MKVToolNix complains about this:

The track number 0 from the file 'D:\title_t01.mkv' can probably not be appended correctly to the track number 0 from the file 'D:\title_t02.mkv': The codec's private data does not match (lengths: 164 and 0). 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.

So it seems I can't figure out the right encode settings. Assistance is greatly appreciated :)

manolito
24th March 2020, 18:02
I have learned that this MKVToolnix warning can be ignored if the encoding settings otherwise match (frame size, frame rate, aspect ratio, chroma subsampling...). I always get this error when I append several AVC/AAC videos. The only difference in the encoding was a newer X264 build by the same dev (Ligh), all other settings were absolutely identical. This is obviously enough to trigger this warning, but the result has always been perfect.

//EDIT//
Since with MPEG2 within an MKV container you will not be restricted to the 29.97 fps presentation framerate (mandatory for DVD), it may be a good idea to remove the RFF flags (soft telecine) from the sources before merging them.

Blue_MiSfit
28th March 2020, 21:23
Maybe do the concatenation with a different tool like mp4box or ffmpeg first?

Adam Cole
19th April 2020, 18:17
Maybe do the concatenation with a different tool like mp4box or ffmpeg first?

MP4Box is garbage, it didn't append my video files. It just put them as seperate video streams in one mp4 container. Yes, I made sure to use the JOIN tab.

ffmpeg produced the same file as mkvtoolnix when appending. I could tell because when playing the video, you can see a clear cut (in form of a black or frozen frame) when the video player reaches the point where video 1 and video 2 have been joined. This all leds to the conclusion that the problem is not the tool used for joining the videos together, but the differences between video 1 and video 2. When I split a video in two and join them back together, the process is smooth without an error message from mkvtoolnix and without any cuts while playing the video. This is to be expected because the splitted video parts are identical in terms of encoding properties.

So the core issue remains, I still haven't figured out how to replicate the 100% absolutely, totally, exact same encoding settings of a given video.

manolito
19th April 2020, 20:48
Can you upload short samples of video1 and video2 ?
(You can cut MPEG2 files with DGIndex)

Emulgator
3rd June 2020, 16:14
Restream can read MPEG-2 streams and can list/add/remove/change private data (user data) if that is what you mean.
NTSC MPEG-2 streams may contain Closed Captions there.