1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MPEG-TS to MKV (remux): Smaller File?

Discussion in 'Other video questions' started by dtmiller1976, Sep 18, 2013.

Thread Status:
Not open for further replies.
  1. dtmiller1976

    dtmiller1976 Newbie

    Joined:
    Sep 18, 2013
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Hi all. I've been a long-term lurker and until now I haven't needed to post. Unfortunately that changed tonight when I attempted to remux an MPEG-TS file into an MKV. The path was a bit indirect but I eventually got there. Here's what I did:

    1. TsRemux: ".mpeg" -> ".m2ts"
    2. mkvmerge: ".m2ts" -> ".mkv"

    Why the two-step? Well, mkvmerge threw errors when I gave it a ".mpeg" so I first had to get to an ".m2ts". That seemed to work, though mkvmerge did complain about additional bytes in the audio stream (and therefore gave a warning that the two might be out of sync). Here's the real question, though: Why is the MKV so much smaller than the M2TS? Check it out:

    MPEG: 11,955,479,300 bytes (11.1 GB)
    M2TS: 12,219,000,192 bytes (11.3 GB)
    MKV: 9,823,195,543 bytes (9.14 GB)

    That's a reduction of almost 18% (from the MPEG) with no re-encoding or element conversion as far as I can tell. Is MKV just way more efficient or am I dropping something along the way? Here's Mediainfo output for each file:


    MPEG
    ----

    General
    ID : 255 (0xFF)
    Complete name : C:\Video\Work\Camcorder\Tape 1.mpeg
    Format : MPEG-TS
    Commercial name : HDV 1080i
    File size : 11.1 GiB
    Duration : 1h 2mn
    Start time : UTC 2008-02-01 01:00:24
    End time : UTC 2008-06-07 12:55:58
    Overall bit rate mode : Variable
    Overall bit rate : 25.5 Mbps
    Maximum Overall bit rate : 33.0 Mbps
    Encoded date : UTC 2008-02-01 01:00:24

    Video
    ID : 2064 (0x810)
    Menu ID : 100 (0x64)
    Format : MPEG Video
    Commercial name : HDV 1080i
    Format version : Version 2
    Format profile : Main@High 1440
    Format settings, BVOP : Yes
    Format settings, Matrix : Custom
    Format settings, GOP : M=3, N=15
    Codec ID : 2
    Duration : 1h 2mn
    Bit rate : 23.8 Mbps
    Maximum bit rate : 25.0 Mbps
    Width : 1 440 pixels
    Height : 1 080 pixels
    Display aspect ratio : 16:9
    Frame rate : 29.970 fps
    Standard : Component
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Interlaced
    Scan order : Top Field First
    Compression mode : Lossy
    Bits/(Pixel*Frame) : 0.511
    Stream size : 10.4 GiB (94%)
    Color primaries : BT.709
    Transfer characteristics : BT.709
    Matrix coefficients : BT.709

    Audio
    ID : 2068 (0x814)
    Menu ID : 100 (0x64)
    Format : MPEG Audio
    Format version : Version 1
    Format profile : Layer 2
    Codec ID : 3
    Duration : 1h 2mn
    Bit rate mode : Constant
    Bit rate : 384 Kbps
    Channel(s) : 2 channels
    Sampling rate : 48.0 KHz
    Compression mode : Lossy
    Delay relative to video : -181ms
    Stream size : 172 MiB (2%)

    Menu
    ID : 129 (0x81)
    Menu ID : 100 (0x64)
    List : 2064 (0x810) (MPEG Video) / 2068 (0x814) (MPEG Audio) / 2069 (0x815) () / 2065 (0x811) ()


    M2TS
    ----

    General
    ID : 1 (0x1)
    Complete name : C:\Video\Work\Camcorder\Tape 1.m2ts
    Format : BDAV
    Format/Info : Blu-ray Video
    Commercial name : HDV 1080i
    File size : 11.4 GiB
    Duration : 1h 1mn
    Overall bit rate mode : Variable
    Overall bit rate : 26.6 Mbps
    Maximum Overall bit rate : 35.5 Mbps

    Video
    ID : 4113 (0x1011)
    Menu ID : 1 (0x1)
    Format : MPEG Video
    Commercial name : HDV 1080i
    Format version : Version 2
    Format profile : Main@High 1440
    Format settings, BVOP : Yes
    Format settings, Matrix : Custom
    Format settings, GOP : M=3, N=15
    Codec ID : 2
    Duration : 1h 1mn
    Bit rate : 25.0 Mbps
    Width : 1 440 pixels
    Height : 1 080 pixels
    Display aspect ratio : 16:9
    Frame rate : 29.970 fps
    Standard : Component
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Interlaced
    Scan order : Top Field First
    Compression mode : Lossy
    Bits/(Pixel*Frame) : 0.536
    Stream size : 10.7 GiB (94%)
    Color primaries : BT.709
    Transfer characteristics : BT.709
    Matrix coefficients : BT.709

    Audio
    ID : 4352 (0x1100)
    Menu ID : 1 (0x1)
    Format : MPEG Audio
    Format version : Version 1
    Format profile : Layer 2
    Codec ID : 4
    Duration : 1h 1mn
    Bit rate mode : Constant
    Bit rate : 384 Kbps
    Channel(s) : 2 channels
    Sampling rate : 48.0 KHz
    Compression mode : Lossy
    Delay relative to video : -296ms
    Stream size : 168 MiB (1%)


    MKV
    ---

    General
    Unique ID : 210217485311190726988062280093030469844 (0x9E266A3C180BD7D68F4E75AA1B58D0D4)
    Complete name : C:\Video\Work\Camcorder\Tape 1.track_4113.mkv
    Format : Matroska
    Format version : Version 4 / Version 2
    File size : 9.15 GiB
    Duration : 1h 0mn
    Overall bit rate : 21.5 Mbps
    Movie name : Tape 1
    Encoded date : UTC 2013-09-18 23:34:56
    Writing application : mkvmerge v6.4.1 ('Omega Point') built on Sep 16 2013 22:05:10
    Writing library : libebml v1.3.0 + libmatroska v1.4.1

    Video
    ID : 1
    Format : MPEG Video
    Commercial name : HDV 1080i
    Format version : Version 2
    Format profile : Main@High 1440
    Format settings, BVOP : No
    Format settings, Matrix : Custom
    Codec ID : V_MPEG2
    Codec ID/Info : MPEG 1 or 2 Video
    Duration : 1h 0mn
    Bit rate : 20.7 Mbps
    Maximum bit rate : 25.0 Mbps
    Width : 1 440 pixels
    Height : 1 080 pixels
    Display aspect ratio : 16:9
    Frame rate mode : Constant
    Frame rate : 29.970 fps
    Standard : Component
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Interlaced
    Scan order : Top Field First
    Compression mode : Lossy
    Bits/(Pixel*Frame) : 0.444
    Time code of first frame : 00:00:00:00
    Time code source : Group of pictures header
    Stream size : 8.80 GiB (96%)
    Title : Video
    Language : English
    Default : Yes
    Forced : No
    Color primaries : BT.709
    Transfer characteristics : BT.709
    Matrix coefficients : BT.709

    Audio
    ID : 2
    Format : MPEG Audio
    Format version : Version 1
    Format profile : Layer 2
    Codec ID : A_MPEG/L2
    Codec ID/Hint : MP2
    Duration : 1h 0mn
    Bit rate mode : Constant
    Bit rate : 384 Kbps
    Channel(s) : 2 channels
    Sampling rate : 48.0 KHz
    Compression mode : Lossy
    Delay relative to video : -67ms
    Stream size : 167 MiB (2%)
    Title : Audio
    Language : English
    Default : Yes
    Forced : No



    Thanks for any guidance!


    Damon

    P.S. Apologies if this is a re-post. I tried to post once before but it never showed up.
     
  2. attar

    attar Senior member

    Joined:
    Jun 17, 2005
    Messages:
    11,496
    Likes Received:
    29
    Trophy Points:
    128
    It's probably that the muxer uses less overhead to get the streams into the mkv container.
    I record .wtv (in my case mpeg2 files) and demux/remux them to .mpg and the file size gets larger - but there's no re-encoding taking place.
     
  3. Maneesh Patel

    Maneesh Patel Newbie

    Joined:
    Feb 26, 2016
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    I have an even more dramatic example, converting a format BDAV to format Matroska:

    $avconv -i input.m2ts -vcodec libx264 -acodec libvorbis output.mkv

    $ls -l input.m2ts
    -rw------- 1 patel patel 21963687936 ...

    $ls -l output.mkv
    -rw------- 1 patel patel 1863399876 ...

    The new file is less than 8.5% of the size of the original! There are fewer audio and subtitle streams, but surely that couldn't account for much. The resolution of the video seems to be the same.

    input.m2ts:

    output.mkv:

    I can't perceive a difference when viewing the original versus the copy. Can someone explain what information is being stored in the m2ts file that uses an extra 18.7 GiB but to all appearances is imperceptible?
     
  4. scorpNZ

    scorpNZ Active member

    Joined:
    Mar 23, 2005
    Messages:
    3,964
    Likes Received:
    39
    Trophy Points:
    78
    Start a new topic as per forum rules regarding hijacking threads
    also before replying to any topic check the last reply date,this thread is getting onto 3 years old
     
  5. ddp

    ddp Moderator Staff Member

    Joined:
    Oct 15, 2004
    Messages:
    38,979
    Likes Received:
    75
    Trophy Points:
    128
    closed due to dead thread
     
Thread Status:
Not open for further replies.

Share This Page