Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exporting MKV loses aspect ratio #1959

Closed
4 tasks done
TotallyGamerJet opened this issue Apr 10, 2024 · 2 comments
Closed
4 tasks done

Exporting MKV loses aspect ratio #1959

TotallyGamerJet opened this issue Apr 10, 2024 · 2 comments

Comments

@TotallyGamerJet
Copy link

The fewer issues I have to read, the more new features I will have time to implement, so I ask that you please try these things first

Steps to reproduce

  1. Drag in file
  2. Import Chapters
  3. Export as MKV

Expected behavior

Export files and doesn't change aspect ratios and have the black bars removed.
Expected output to look similar to this. I used handbrake encoding.
image

Actual behavior

The exported files have their aspect ratio changed and kept the black bars.
Original:
image
Exported:
image

Provide an error report

No error occurred.

{
  "state": {
    "ffmpegExperimental": false,
    "preserveMovData": false,
    "movFastStart": true,
    "preserveMetadataOnMerge": false,
    "filePath": "/Users/jarrettkuklis/Episode S05E02-03.mkv",
    "fileFormat": "matroska",
    "externalFilesMeta": {},
    "mainStreams": [
      {
        "index": 0,
        "codec_name": "mpeg2video",
        "codec_long_name": "MPEG-2 video",
        "profile": "Main",
        "codec_type": "video",
        "codec_tag_string": "[0][0][0][0]",
        "codec_tag": "0x0000",
        "width": 720,
        "height": 480,
        "coded_width": 0,
        "coded_height": 0,
        "closed_captions": 0,
        "film_grain": 0,
        "has_b_frames": 1,
        "sample_aspect_ratio": "8:9",
        "display_aspect_ratio": "4:3",
        "pix_fmt": "yuv420p",
        "level": 8,
        "color_range": "tv",
        "color_space": "smpte170m",
        "color_transfer": "smpte170m",
        "color_primaries": "smpte170m",
        "chroma_location": "left",
        "field_order": "progressive",
        "refs": 1,
        "r_frame_rate": "30000/1001",
        "avg_frame_rate": "30000/1001",
        "time_base": "1/1000",
        "start_pts": 0,
        "start_time": "0.000000",
        "extradata_size": 164,
        "disposition": {
          "default": 0,
          "dub": 0,
          "original": 0,
          "comment": 0,
          "lyrics": 0,
          "karaoke": 0,
          "forced": 0,
          "hearing_impaired": 0,
          "visual_impaired": 0,
          "clean_effects": 0,
          "attached_pic": 0,
          "timed_thumbnails": 0,
          "captions": 0,
          "descriptions": 0,
          "metadata": 0,
          "dependent": 0,
          "still_image": 0
        },
        "tags": {
          "language": "eng",
          "BPS-eng": "7280092",
          "DURATION-eng": "00:23:50.762666666",
          "NUMBER_OF_FRAMES-eng": "34304",
          "NUMBER_OF_BYTES-eng": "1302009884",
          "SOURCE_ID-eng": "0100E0",
          "_STATISTICS_WRITING_APP-eng": "MakeMKV v1.17.3 linux(x64-release)",
          "_STATISTICS_WRITING_DATE_UTC-eng": "2023-05-02 03:14:13",
          "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID"
        },
        "side_data_list": [
          {
            "side_data_type": "CPB properties",
            "max_bitrate": 9800000,
            "min_bitrate": 0,
            "avg_bitrate": 0,
            "buffer_size": 1835008,
            "vbv_delay": -1
          }
        ]
      },
      {
        "index": 1,
        "codec_name": "ac3",
        "codec_long_name": "ATSC A/52A (AC-3)",
        "codec_type": "audio",
        "codec_tag_string": "[0][0][0][0]",
        "codec_tag": "0x0000",
        "sample_fmt": "fltp",
        "sample_rate": "48000",
        "channels": 2,
        "channel_layout": "stereo",
        "bits_per_sample": 0,
        "initial_padding": 0,
        "r_frame_rate": "0/0",
        "avg_frame_rate": "0/0",
        "time_base": "1/1000",
        "start_pts": 0,
        "start_time": "0.000000",
        "bit_rate": "192000",
        "disposition": {
          "default": 1,
          "dub": 0,
          "original": 0,
          "comment": 0,
          "lyrics": 0,
          "karaoke": 0,
          "forced": 0,
          "hearing_impaired": 0,
          "visual_impaired": 0,
          "clean_effects": 0,
          "attached_pic": 0,
          "timed_thumbnails": 0,
          "captions": 0,
          "descriptions": 0,
          "metadata": 0,
          "dependent": 0,
          "still_image": 0
        },
        "tags": {
          "language": "eng",
          "title": "Stereo",
          "BPS-eng": "192000",
          "DURATION-eng": "00:23:50.720000000",
          "NUMBER_OF_FRAMES-eng": "44710",
          "NUMBER_OF_BYTES-eng": "34337280",
          "SOURCE_ID-eng": "0180BD",
          "_STATISTICS_WRITING_APP-eng": "MakeMKV v1.17.3 linux(x64-release)",
          "_STATISTICS_WRITING_DATE_UTC-eng": "2023-05-02 03:14:13",
          "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID"
        }
      },
      {
        "index": 2,
        "codec_name": "subrip",
        "codec_long_name": "SubRip subtitle",
        "codec_type": "subtitle",
        "codec_tag_string": "[0][0][0][0]",
        "codec_tag": "0x0000",
        "r_frame_rate": "0/0",
        "avg_frame_rate": "0/0",
        "time_base": "1/1000",
        "start_pts": 0,
        "start_time": "0.000000",
        "duration_ts": 1430762,
        "duration": "1430.762000",
        "disposition": {
          "default": 1,
          "dub": 0,
          "original": 0,
          "comment": 0,
          "lyrics": 0,
          "karaoke": 0,
          "forced": 0,
          "hearing_impaired": 0,
          "visual_impaired": 0,
          "clean_effects": 0,
          "attached_pic": 0,
          "timed_thumbnails": 0,
          "captions": 0,
          "descriptions": 0,
          "metadata": 0,
          "dependent": 0,
          "still_image": 0
        },
        "tags": {
          "language": "eng",
          "BPS-eng": "133",
          "DURATION-eng": "00:23:44.787166666",
          "NUMBER_OF_FRAMES-eng": "494",
          "NUMBER_OF_BYTES-eng": "23702",
          "SOURCE_ID-eng": "0100E0",
          "_STATISTICS_WRITING_APP-eng": "MakeMKV v1.17.3 linux(x64-release)",
          "_STATISTICS_WRITING_DATE_UTC-eng": "2023-05-02 03:14:13",
          "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID"
        }
      }
    ],
    "copyStreamIdsByFile": {
      "/Users/jarrettkuklis/Episode S05E02-03.mkv": {
        "0": true,
        "1": true,
        "2": true
      }
    },
    "cutSegments": [
      {
        "start": 0,
        "end": 715.548167
      },
      {
        "start": 715.548167,
        "end": 1430.762667
      }
    ],
    "mainFileFormatData": {
      "filename": "/Users/jarrettkuklis/Episode S05E02-03.mkv",
      "nb_streams": 3,
      "nb_programs": 0,
      "format_name": "matroska,webm",
      "format_long_name": "Matroska / WebM",
      "start_time": "0.000000",
      "duration": "1430.762000",
      "size": "1337276965",
      "bit_rate": "7477285",
      "probe_score": 100,
      "tags": {
        "encoder": "libmakemkv v1.17.3 (1.3.10/1.5.2) x86_64-unknown-linux-gnu",
        "creation_time": "2023-05-02T03:14:13.000000Z"
      }
    },
    "rotation": 360,
    "shortestFlag": false,
    "effectiveExportMode": "separate",
    "outSegTemplate": "${FILENAME}@@@${SEG_NUM}${EXT}"
  },
  "platform": "darwin",
  "version": "3.59.1"
}

Share the file

Emailed

Share log from developer tools

Version 3.59.1
index-18074aaf.js:298 userOpenFiles
index-18074aaf.js:298 /Users/jarrettkuklis/Episode S05E02-03.mkv
index-18074aaf.js:298 loadMedia /Users/jarrettkuklis/Episode S05E02-03.mkv undefined undefined
index-18074aaf.js:298 State reset
index-18074aaf.js:298 Found existing html5 friendly file /Users/jarrettkuklis/Episode S05E02-03-html5ified-dummy.mkv
index-18074aaf.js:298 Loading EDL file llc /Users/jarrettkuklis/Episode S05E02-03-proj.llc undefined
index-18074aaf.js:298 onDurationChange 1430.762
index-18074aaf.js:298 outSegTemplateOrDefault ${FILENAME}@@@${SEG_NUM}${EXT}
index-18074aaf.js:167 customTagsByFile {}
index-18074aaf.js:167 paramsByStreamId Map(0) {size: 0}
index-18074aaf.js:167 Cutting from start to 715.548167
index-18074aaf.js:160 STDERR:
index-18074aaf.js:160 Input #0, matroska,webm, from '/Users/jarrettkuklis/Episode S05E02-03.mkv':
  Metadata:
    encoder         : libmakemkv v1.17.3 (1.3.10/1.5.2) x86_64-unknown-linux-gnu
    creation_time   : 2023-05-02T03:14:13.000000Z
  Duration: 00:23:50.76, start: 0.000000, bitrate: 7477 kb/s
  Chapters:
    Chapter #0:0: start 0.000000, end 715.548167
      Metadata:
        title           : Chapter 01
    Chapter #0:1: start 715.548167, end 1430.762667
      Metadata:
        title           : Chapter 02
  Stream #0:0(eng): Video: mpeg2video (Main), yuv420p(tv, smpte170m, progressive), 720x480 [SAR 32:27 DAR 16:9], SAR 8:9 DAR 4:3, 29.97 fps, 29.97 tbr, 1k tbn
    Metadata:
      BPS-eng         : 7280092
      DURATION-eng    : 00:23:50.762666666
      NUMBER_OF_FRAMES-eng: 34304
      NUMBER_OF_BYTES-eng: 1302009884
      SOURCE_ID-eng   : 0100E0
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.3 linux(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2023-05-02 03:14:13
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
    Side data:
      cpb: bitrate max/min/avg: 9800000/0/0 buffer size: 1835008 vbv_delay: N/A
  Stream #0:1(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      title           : Stereo
      BPS-eng         : 192000
      DURATION-eng    : 00:23:50.720000000
      NUMBER_OF_FRAMES-eng: 44710
      NUMBER_OF_BYTES-eng: 34337280
      SOURCE_ID-eng   : 0180BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.3 linux(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2023-05-02 03:14:13
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  Stream #0:2(eng): Subtitle: subrip (default)
    Metadata:
      BPS-eng         : 133
      DURATION-eng    : 00:23:44.787166666
      NUMBER_OF_FRAMES-eng: 494
      NUMBER_OF_BYTES-eng: 23702
      SOURCE_ID-eng   : 0100E0
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.3 linux(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2023-05-02 03:14:13
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
Output #0, matroska, to '/Users/jarrettkuklis/Episode S05E02-03@@@1.mkv':
  Metadata:
    creation_time   : 2023-05-02T03:14:13.000000Z
    encoder         : Lavf60.3.100
  Chapters:
    Chapter #0:0: start 0.000000, end 715.548167
      Metadata:
        title           : Chapter 01
    Chapter #0:1: start 715.548167, end 715.548170
      Metadata:
        title           : Chapter 02
  Stream #0:0(eng): Video: mpeg2video (Main) (mpg2 / 0x3267706D), yuv420p(tv, smpte170m, progressive), 720x480 [SAR 8:9 DAR 4:3], q=2-31, 29.97 fps, 29.97 tbr, 1k tbn
    Metadata:
      BPS-eng         : 7280092
      DURATION-eng    : 00:23:50.762666666
      NUMBER_OF_FRAMES-eng: 34304
      NUMBER_OF_BYTES-eng: 1302009884
      SOURCE_ID-eng   : 0100E0
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.3 linux(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2023-05-02 03:14:13
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
    Side data:
      cpb: bitrate max/min/avg: 9800000/0/0 buffer size: 1835008 vbv_delay: N/A
  Stream #0:1(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      title           : Stereo
      BPS-eng         : 192000
      DURATION-eng    : 00:23:50.720000000
      NUMBER_OF_FRAMES-eng: 44710
      NUMBER_OF_BYTES-eng: 34337280
      SOURCE_ID-eng   : 0180BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.3 linux(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2023-05-02 03:14:13
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  Stream #0:2(eng): Subtitle: subrip (default)
    Metadata:
      BPS-eng         : 133
      DURATION-eng    : 00:23:44.787166666
      NUMBER_OF_FRAMES-eng: 494
      NUMBER_OF_BYTES-eng: 23702
      SOURCE_ID-eng   : 0100E0
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.3 linux(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2023-05-02 03:14:13
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
Press [q] to stop, [?] for help
frame=    0 fps=0.0 q=-1.0 size=       0kB time=-00:00:00.03 bitrate=  -0.0kbits/s speed=N/A    
frame= 6991 fps=0.0 q=-1.0 size=  265984kB time=00:04:51.64 bitrate=7471.1kbits/s speed= 581x    
frame=14215 fps=14168 q=-1.0 size=  546048kB time=00:09:52.89 bitrate=7544.7kbits/s speed= 591x    
frame=17158 fps=14236 q=-1.0 Lsize=  654125kB time=00:11:55.54 bitrate=7488.8kbits/s speed= 594x    
video:636986kB audio:16771kB subtitle:11kB other streams:0kB global headers:0kB muxing overhead: 0.054666%
index-18074aaf.js:167 Cutting from 715.548167 to end
index-18074aaf.js:160 STDERR:
index-18074aaf.js:160 Input #0, matroska,webm, from '/Users/jarrettkuklis/Episode S05E02-03.mkv':
  Metadata:
    encoder         : libmakemkv v1.17.3 (1.3.10/1.5.2) x86_64-unknown-linux-gnu
    creation_time   : 2023-05-02T03:14:13.000000Z
  Duration: 00:23:50.76, start: 0.000000, bitrate: 7477 kb/s
  Chapters:
    Chapter #0:0: start 0.000000, end 715.548167
      Metadata:
        title           : Chapter 01
    Chapter #0:1: start 715.548167, end 1430.762667
      Metadata:
        title           : Chapter 02
  Stream #0:0(eng): Video: mpeg2video (Main), yuv420p(tv, smpte170m, progressive), 720x480 [SAR 32:27 DAR 16:9], SAR 8:9 DAR 4:3, 29.97 fps, 29.97 tbr, 1k tbn
    Metadata:
      BPS-eng         : 7280092
      DURATION-eng    : 00:23:50.762666666
      NUMBER_OF_FRAMES-eng: 34304
      NUMBER_OF_BYTES-eng: 1302009884
      SOURCE_ID-eng   : 0100E0
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.3 linux(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2023-05-02 03:14:13
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
    Side data:
      cpb: bitrate max/min/avg: 9800000/0/0 buffer size: 1835008 vbv_delay: N/A
  Stream #0:1(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      title           : Stereo
      BPS-eng         : 192000
      DURATION-eng    : 00:23:50.720000000
      NUMBER_OF_FRAMES-eng: 44710
      NUMBER_OF_BYTES-eng: 34337280
      SOURCE_ID-eng   : 0180BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.3 linux(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2023-05-02 03:14:13
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  Stream #0:2(eng): Subtitle: subrip (default)
    Metadata:
      BPS-eng         : 133
      DURATION-eng    : 00:23:44.787166666
      NUMBER_OF_FRAMES-eng: 494
      NUMBER_OF_BYTES-eng: 23702
      SOURCE_ID-eng   : 0100E0
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.3 linux(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2023-05-02 03:14:13
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
Output #0, matroska, to '/Users/jarrettkuklis/Episode S05E02-03@@@2.mkv':
  Metadata:
    creation_time   : 2023-05-02T03:14:13.000000Z
    encoder         : Lavf60.3.100
  Chapters:
    Chapter #0:0: start 0.000000, end 715.214497
      Metadata:
        title           : Chapter 02
  Stream #0:0(eng): Video: mpeg2video (Main) (mpg2 / 0x3267706D), yuv420p(tv, smpte170m, progressive), 720x480 [SAR 8:9 DAR 4:3], q=2-31, 29.97 fps, 29.97 tbr, 1k tbn
    Metadata:
      BPS-eng         : 7280092
      DURATION-eng    : 00:23:50.762666666
      NUMBER_OF_FRAMES-eng: 34304
      NUMBER_OF_BYTES-eng: 1302009884
      SOURCE_ID-eng   : 0100E0
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.3 linux(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2023-05-02 03:14:13
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
    Side data:
      cpb: bitrate max/min/avg: 9800000/0/0 buffer size: 1835008 vbv_delay: N/A
  Stream #0:1(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      title           : Stereo
      BPS-eng         : 192000
      DURATION-eng    : 00:23:50.720000000
      NUMBER_OF_FRAMES-eng: 44710
      NUMBER_OF_BYTES-eng: 34337280
      SOURCE_ID-eng   : 0180BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.3 linux(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2023-05-02 03:14:13
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  Stream #0:2(eng): Subtitle: subrip (default)
    Metadata:
      BPS-eng         : 133
      DURATION-eng    : 00:23:44.787166666
      NUMBER_OF_FRAMES-eng: 494
      NUMBER_OF_BYTES-eng: 23702
      SOURCE_ID-eng   : 0100E0
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.3 linux(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2023-05-02 03:14:13
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
Press [q] to stop, [?] for help
frame=    0 fps=0.0 q=-1.0 size=       0kB time=-00:00:00.30 bitrate=  -0.0kbits/s speed=N/A    
[matroska @ 0x11ce3bf10] Non-monotonous DTS in output stream 0:0; previous: -300, current: -384; changing to -300. This may result in incorrect timestamps in the output file.
[matroska @ 0x11ce3bf10] Non-monotonous DTS in output stream 0:0; previous: -300, current: -333; changing to -300. This may result in incorrect timestamps in the output file.
frame= 7010 fps=0.0 q=-1.0 size=  266496kB time=00:04:52.10 bitrate=7473.9kbits/s speed= 581x    
frame=13277 fps=13228 q=-1.0 size=  510976kB time=00:09:13.54 bitrate=7562.1kbits/s speed= 551x    
frame=17157 fps=13368 q=-1.0 Lsize=  651677kB time=00:11:55.14 bitrate=7465.0kbits/s speed= 557x    
video:634541kB audio:16768kB subtitle:12kB other streams:0kB global headers:0kB muxing overhead: 0.054739%
@mifi
Copy link
Owner

mifi commented Apr 10, 2024

Export files and doesn't change aspect ratios and have the black bars removed.

FYI removing black bars will probably never be possible in losslesscut because it requires re-encoding.

As for the aspect ratio, I think similar to this issue #1336 - I think some metadata (e.g. aspect ratio) gets lost when exporting.

I opened the input file (Episode S05E02-03.mkv) in IINA and it looks like this:

Screenshot 2024-04-10 at 22 15 50

seems VLC parses the file differently because it shows it wider:

Screenshot 2024-04-10 at 22 16 12

if I export using losslesscut and open in VLC I can confirm I also see the 4/3 aspect ratio.

@mifi mifi changed the title Exporting MKV resizes file but keeps black bars Exporting MKV loses aspect ratio Apr 10, 2024
@mifi
Copy link
Owner

mifi commented Apr 10, 2024

BTW comparing input/output in MediaInfo, there are many more differences between input and output:

Screenshot 2024-04-10 at 22 50 17

Unfortunately this issue is one of many related to lost metadata, and I don't know how to fix it. Most likely it's a bug in ffmpeg. I will add this issue to #1027 and I'll close this to keep issues down.

@mifi mifi closed this as completed Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants