VideoHelp Forum




+ Reply to Thread
Results 1 to 5 of 5
  1. So I noticed that after using mkvtoolnix on the .m2ts file, the .mkv output was a bit smaller. I took a closer look at them with mediainfo and saw that the video streaming size got smaller.
    Image
    [Attachment 54598 - Click to enlarge]

    Image
    [Attachment 54599 - Click to enlarge]

    From what I read on another thread, this could be because of MKVToolNix removing empty filler NALUs. But I also read that by demuxing the video stream from both the .m2ts and .mkv file with something like tsMuxeR, I could compare the two and see that it's the same data/size, but it wasn't the case.
    .m2ts tsMuxeR demux output:
    Image
    [Attachment 54600 - Click to enlarge]

    .mkv tsMuxeR demux output:
    Image
    [Attachment 54601 - Click to enlarge]

    Size comparison:
    Image
    [Attachment 54602 - Click to enlarge]

    I also tried to check the video integrity of the .mkv file with ffmpeg: ffmpeg -v error -i 00005.mkv -f null - 2>00005mkv.log
    but what I got was this:
    Image
    [Attachment 54603 - Click to enlarge]

    even tho while doing the same integrity check on the .m2ts file: ffmpeg -v error -i 00005.m2ts -f null - 2>00005m2ts.log
    did not result in ffmpeg giving me any kind of error.

    I would love to hear some opinions on what might be going on here since I'm kinda lost and did not find anything on other threads that could enlighten me, either.
    Last edited by RaresCelTare; 23rd Aug 2020 at 16:37.
    Quote Quote  
  2. Not sure about the audio warning that ffmpeg gives - but a change in container and elementary stream size is "normal" and expected when using MKV

    mkvmerge removes filler packets, sync bytes, AUD NALs, and strips repeated headers(uses global header instead) and sequence headers. The stripped sequence headers from the elementary bitstream is the main explanation for the small difference when demuxed. This is well documented for AVC, because this causes compatibility problems with AVC BD authoring in strict/professional programs such as Scenarist BD (thus people avoid MKV container when authoring, and always use elementary streams)

    The actual video data - the decoded bitstream - will be identical. eg. You can check with PSNR. (If it's not infinity/lossless, then there is a problem.)

    Sometimes there are audio "gaps" in the source file, and using eac3to to mux into MKV can fix them. Or sometimes ffmpeg is wrong
    Quote Quote  
  3. Originally Posted by poisondeathray View Post
    You can check with PSNR. (If it's not infinity/lossless, then there is a problem.)
    What would you recommend me to use to check the PSNR of the demuxed video stream to see if it gives me infinity, because all I could find was an ffmpeg command to encode the video and after that, give me a VMAF and PSNR score.
    Quote Quote  
  4. Originally Posted by RaresCelTare View Post
    Originally Posted by poisondeathray View Post
    You can check with PSNR. (If it's not infinity/lossless, then there is a problem.)
    What would you recommend me to use to check the PSNR of the demuxed video stream to see if it gives me infinity, because all I could find was an ffmpeg command to encode the video and after that, give me a VMAF and PSNR score.
    VMAF is no good for this, because it does not necessarily register "lossless" or 100 . There is subjective "fudge factor" in the calculation

    PSNR is mathematically ideal and perfect for determining lossless vs. not

    You need to "force" the frame rate and time base when using ffmpeg - because ffmpeg uses timestamps to control everything (not frames), and container timebase differences can cause you to measure different frames causing inaccurate results

    If you just want to check it to see the total (faster), without printing a per frame log file

    Code:
    ffmpeg -r 24000/1001 -i 1.0005.mkv -r 24000/1001 -i 0005.m2ts -lavfi  "[0:v]settb=1/AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=1/AVTB,setpts=PTS-STARTPTS[ref];[main][ref]psnr" -f null -
    Quote Quote  
  5. The PSNR did result in infinity.
    Image
    [Attachment 54605 - Click to enlarge]

    Thank you very much for your help and for being so smart because I would have never been able to make such a command to find what I needed.
    Originally Posted by poisondeathray View Post
    Code:
    ffmpeg -r 24000/1001 -i 00005.mkv -r 24000/1001 -i 00005.m2ts -lavfi  "[0:v]settb=1/AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=1/AVTB,setpts=PTS-STARTPTS[ref];[main][ref]psnr" -f null -
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!