mifi / lossless-cut

The swiss army knife of lossless video/audio editing
https://losslesscut.app/
GNU General Public License v2.0
27.68k stars 1.34k forks source link

Error when exporting MKV to MP4 #893

Closed realKitsune closed 2 years ago

realKitsune commented 3 years ago

Hi, I tried to convert a MKV file to MP4 and got error, I tried all the steps before posting here. Only matroska worked, but that's not what I need here. I require MP4 - AAC

Tried with another file same problem

Error: Command failed with exit code 1: C:\Users\Kitsune\AppData\Local\Temp\1xMTtfMQLboD7r4ebGikn7zfvcn\resources\node_modules\ffmpeg-ffprobe-static\ffmpeg.exe -hide_banner -i C:\Users\Kitsune\Downloads\Squid.Game.S01.KOREAN.WEBRip.x264-NoTag\Squid.Game.S01E01.KOREAN.WEBRip.x264-NoTag-00.00.00.900-00.59.42.250.mkv -c copy -map 0:0 -map 0:1 -map 0:2 -map_metadata 0 -movflags +faststart -ignore_unknown -f mp4 -y C:\Users\Kitsune\Downloads\Squid.Game.S01E01.KOREAN.WEBRip.x264-NoTag-00.00.00.900-00.59.42.250-00.00.00.000-00.59.42.289.mp4 Input #0, matroska,webm, from 'C:\Users\Kitsune\Downloads\Squid.Game.S01.KOREAN.WEBRip.x264-NoTag\Squid.Game.S01E01.KOREAN.WEBRip.x264-NoTag-00.00.00.900-00.59.42.250.mkv': Metadata: creation_time : 2021-09-30T20:36:10.000000Z ENCODER : Lavf58.45.100 Duration: 00:59:42.29, start: 0.083000, bitrate: 1314 kb/s Stream #0:0(kor): Video: h264 (High), yuv420p(progressive), 720x360 [SAR 1:1 DAR 2:1], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default) Metadata: BPS-eng : 1054308 DURATION-eng : 00:59:42.162000000 NUMBER_OF_FRAMES-eng: 85886 NUMBER_OF_BYTES-eng: 472088119 _STATISTICS_WRITING_APP-eng: mkvmerge v52.0.0 ('Secret For The Mad') 64-bit _STATISTICS_WRITING_DATE_UTC-eng: 2021-09-30 20:36:10 _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES DURATION : 00:59:42.244000000 Stream #0:1(kor): Audio: aac (LC), 48000 Hz, stereo, fltp (default) Metadata: BPS-eng : 256000 DURATION-eng : 00:59:42.250000000 NUMBER_OF_FRAMES-eng: 167918 NUMBER_OF_BYTES-eng: 114632022 _STATISTICS_WRITING_APP-eng: mkvmerge v52.0.0 ('Secret For The Mad') 64-bit _STATISTICS_WRITING_DATE_UTC-eng: 2021-09-30 20:36:10 _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES DURATION : 00:59:42.290000000 Stream #0:2(fre): Subtitle: subrip (default) Metadata: BPS-eng : 47 DURATION-eng : 00:58:06.311000000 NUMBER_OF_FRAMES-eng: 640 NUMBER_OF_BYTES-eng: 20758 _STATISTICS_WRITING_APP-eng: mkvmerge v52.0.0 ('Secret For The Mad') 64-bit _STATISTICS_WRITING_DATE_UTC-eng: 2021-09-30 20:36:10 _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES DURATION : 00:58:12.398000000 [mp4 @ 0000020aba630540] Could not find tag for codec subrip in stream #2, codec not currently supported in container Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Stream #0:2 -> #0:2 (copy) Last message repeated 1 times at makeError (C:\Users\Kitsune\AppData\Local\Temp\1xMTtfMQLboD7r4ebGikn7zfvcn\resources\app.asar\node_modules\execa\lib\error.js:59:11) at handlePromise (C:\Users\Kitsune\AppData\Local\Temp\1xMTtfMQLboD7r4ebGikn7zfvcn\resources\app.asar\node_modules\execa\index.js:114:26) at async O (file:///C:/Users/Kitsune/AppData/Local/Temp/1xMTtfMQLboD7r4ebGikn7zfvcn/resources/app.asar/build/static/js/main.220201e5.chunk.js:1:65013) at async file:///C:/Users/Kitsune/AppData/Local/Temp/1xMTtfMQLboD7r4ebGikn7zfvcn/resources/app.asar/build/static/js/main.220201e5.chunk.js:1:65219 at async file:///C:/Users/Kitsune/AppData/Local/Temp/1xMTtfMQLboD7r4ebGikn7zfvcn/resources/app.asar/build/static/js/main.220201e5.chunk.js:1:192095 at async file:///C:/Users/Kitsune/AppData/Local/Temp/1xMTtfMQLboD7r4ebGikn7zfvcn/resources/app.asar/build/static/js/main.220201e5.chunk.js:1:194036

{ "err": { "killed": false, "failed": true, "timedOut": false, "isCanceled": false, "exitCode": 1 }, "state": { "filePath": "C:\Users\Kitsune\Downloads\Squid.Game.S01.KOREAN.WEBRip.x264-NoTag\Squid.Game.S01E01.KOREAN.WEBRip.x264-NoTag-00.00.00.900-00.59.42.250.mkv", "fileFormat": "mp4", "externalStreamFiles": [], "mainStreams": [ { "index": 0, "codec_name": "h264", "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10", "profile": "High", "codec_type": "video", "codec_time_base": "1001/48000", "codec_tag_string": "[0][0][0][0]", "codec_tag": "0x0000", "width": 720, "height": 360, "coded_width": 720, "coded_height": 368, "closed_captions": 0, "has_b_frames": 2, "sample_aspect_ratio": "1:1", "display_aspect_ratio": "2:1", "pix_fmt": "yuv420p", "level": 31, "chroma_location": "left", "field_order": "progressive", "refs": 1, "is_avc": "true", "nal_length_size": "4", "r_frame_rate": "24000/1001", "avg_frame_rate": "24000/1001", "time_base": "1/1000", "start_pts": 83, "start_time": "0.083000", "bits_per_raw_sample": "8", "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 }, "tags": { "language": "kor", "BPS-eng": "1054308", "DURATION-eng": "00:59:42.162000000", "NUMBER_OF_FRAMES-eng": "85886", "NUMBER_OF_BYTES-eng": "472088119", "_STATISTICS_WRITING_APP-eng": "mkvmerge v52.0.0 ('Secret For The Mad') 64-bit", "_STATISTICS_WRITING_DATE_UTC-eng": "2021-09-30 20:36:10", "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES", "DURATION": "00:59:42.244000000" } }, { "index": 1, "codec_name": "aac", "codec_long_name": "AAC (Advanced Audio Coding)", "profile": "LC", "codec_type": "audio", "codec_time_base": "1/48000", "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, "r_frame_rate": "0/0", "avg_frame_rate": "0/0", "time_base": "1/1000", "start_pts": 211, "start_time": "0.211000", "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 }, "tags": { "language": "kor", "BPS-eng": "256000", "DURATION-eng": "00:59:42.250000000", "NUMBER_OF_FRAMES-eng": "167918", "NUMBER_OF_BYTES-eng": "114632022", "_STATISTICS_WRITING_APP-eng": "mkvmerge v52.0.0 ('Secret For The Mad') 64-bit", "_STATISTICS_WRITING_DATE_UTC-eng": "2021-09-30 20:36:10", "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES", "DURATION": "00:59:42.290000000" } }, { "index": 2, "codec_name": "subrip", "codec_long_name": "SubRip subtitle", "codec_type": "subtitle", "codec_time_base": "0/1", "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": 83, "start_time": "0.083000", "duration_ts": 3582290, "duration": "3582.290000", "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 }, "tags": { "language": "fre", "BPS-eng": "47", "DURATION-eng": "00:58:06.311000000", "NUMBER_OF_FRAMES-eng": "640", "NUMBER_OF_BYTES-eng": "20758", "_STATISTICS_WRITING_APP-eng": "mkvmerge v52.0.0 ('Secret For The Mad') 64-bit", "_STATISTICS_WRITING_DATE_UTC-eng": "2021-09-30 20:36:10", "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES", "DURATION": "00:58:12.398000000" } } ], "copyStreamIdsByFile": { "C:\Users\Kitsune\Downloads\Squid.Game.S01.KOREAN.WEBRip.x264-NoTag\Squid.Game.S01E01.KOREAN.WEBRip.x264-NoTag-00.00.00.900-00.59.42.250.mkv": { "0": true, "1": true, "2": true } }, "cutSegments": [ {} ], "fileFormatData": { "filename": "C:\Users\Kitsune\Downloads\Squid.Game.S01.KOREAN.WEBRip.x264-NoTag\Squid.Game.S01E01.KOREAN.WEBRip.x264-NoTag-00.00.00.900-00.59.42.250.mkv", "nb_streams": 3, "nb_programs": 0, "format_name": "matroska,webm", "format_long_name": "Matroska / WebM", "start_time": "0.083000", "duration": "3582.290000", "size": "588584377", "bit_rate": "1314431", "probe_score": 100, "tags": { "creation_time": "2021-09-30T20:36:10.000000Z", "ENCODER": "Lavf58.45.100" } }, "rotation": 360, "shortestFlag": false }, "platform": "win32", "version": "3.39.0" }

mifi commented 3 years ago

Disable the subtitle track (track 3). Afaik it is not supported by mp4. If you want to keep the subtitle, you you need to use an external tool to first convert it to a subtitle format that mp4 supports, then re-add it

taozi1996 commented 3 years ago

Disable the subtitle track (track 3). Afaik it is not supported by mp4. If you want to keep the subtitle, you you need to use an external tool to first convert it to a subtitle format that mp4 supports, then re-add it

mp4 support subtitle which is mov_text. If a mkv file include .srt ffmpeg -i test.mkv -map 0:v -c:v copy -map 0:a -c:a copy -map 0:s -c:s mov_text output.mp4

mifi commented 2 years ago

Yep, need to convert to mov_text first, which is not necessarily lossless but it may often be. Closing in favor of this existing issue #418