Opened 2 years ago

Closed 2 years ago

Last modified 20 months ago

#9515 closed defect (invalid)

Error on remuxing mkv file

Reported by: Markus Hempel Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

I'm trying to remux a mkv file only with selected streams.
All streams should only be copied, not converted or encoded.
Following Error occured:

Error initializing output stream 0:2 -- Subtitle encoding currently only possible from text to text or bitmap to bitmap

I don't wan't to encode something, this message makes no sense when streams should ony be copied.

Thanks for help

ffprobe output:

{
    "streams": [
        {
            "index": 0,
            "codec_name": "h264",
            "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
            "profile": "High",
            "codec_type": "video",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "width": 1920,
            "height": 800,
            "coded_width": 1920,
            "coded_height": 800,
            "closed_captions": 0,
            "has_b_frames": 2,
            "sample_aspect_ratio": "1:1",
            "display_aspect_ratio": "12:5",
            "pix_fmt": "yuv420p",
            "level": 41,
            "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": 0,
            "start_time": "0.000000",
            "bits_per_raw_sample": "8",
            "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
            },
            "tags": {
                "_STATISTICS_WRITING_APP": "mkvmerge v7.4.0 ('Circles') 64bit built on Dec 12 2014 12:19:56",
                "_STATISTICS_WRITING_APP-eng": "mkvmerge v7.4.0 ('Circles') 64bit built on Dec 12 2014 12:19:56",
                "_STATISTICS_WRITING_DATE_UTC": "2014-12-23 23:19:28",
                "_STATISTICS_WRITING_DATE_UTC-eng": "2014-12-23 23:19:28",
                "_STATISTICS_TAGS": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES",
                "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES",
                "BPS": "5864136",
                "BPS-eng": "5864136",
                "DURATION": "02:00:51.203000000",
                "DURATION-eng": "02:00:51.203000000",
                "NUMBER_OF_FRAMES": "173855",
                "NUMBER_OF_FRAMES-eng": "173855",
                "NUMBER_OF_BYTES": "5315255187",
                "NUMBER_OF_BYTES-eng": "5315255187"
            }
        },
        {
            "index": 1,
            "codec_name": "dvd_subtitle",
            "codec_long_name": "DVD subtitles",
            "codec_type": "subtitle",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "width": 1920,
            "height": 1080,
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/1000",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 7251203,
            "duration": "7251.203000",
            "disposition": {
                "default": 1,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 1,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0
            },
            "tags": {
                "language": "ger",
                "title": "forced",
                "_STATISTICS_WRITING_APP": "mkvmerge v7.4.0 ('Circles') 64bit built on Dec 12 2014 12:19:56",
                "_STATISTICS_WRITING_APP-eng": "mkvmerge v7.4.0 ('Circles') 64bit built on Dec 12 2014 12:19:56",
                "_STATISTICS_WRITING_DATE_UTC": "2014-12-23 23:19:28",
                "_STATISTICS_WRITING_DATE_UTC-eng": "2014-12-23 23:19:28",
                "_STATISTICS_TAGS": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES",
                "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES",
                "BPS": "168",
                "BPS-eng": "168",
                "DURATION": "00:04:04.200000000",
                "DURATION-eng": "00:04:04.200000000",
                "NUMBER_OF_FRAMES": "2",
                "NUMBER_OF_FRAMES-eng": "2",
                "NUMBER_OF_BYTES": "5139",
                "NUMBER_OF_BYTES-eng": "5139"
            }
        },
        {
            "index": 2,
            "codec_name": "dvd_subtitle",
            "codec_long_name": "DVD subtitles",
            "codec_type": "subtitle",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "width": 1920,
            "height": 1080,
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/1000",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 7251203,
            "duration": "7251.203000",
            "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
            },
            "tags": {
                "language": "ger",
                "title": "complete",
                "_STATISTICS_WRITING_APP": "mkvmerge v7.4.0 ('Circles') 64bit built on Dec 12 2014 12:19:56",
                "_STATISTICS_WRITING_APP-eng": "mkvmerge v7.4.0 ('Circles') 64bit built on Dec 12 2014 12:19:56",
                "_STATISTICS_WRITING_DATE_UTC": "2014-12-23 23:19:28",
                "_STATISTICS_WRITING_DATE_UTC-eng": "2014-12-23 23:19:28",
                "_STATISTICS_TAGS": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES",
                "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES",
                "BPS": "6610",
                "BPS-eng": "6610",
                "DURATION": "02:00:31.672000000",
                "DURATION-eng": "02:00:31.672000000",
                "NUMBER_OF_FRAMES": "1406",
                "NUMBER_OF_FRAMES-eng": "1406",
                "NUMBER_OF_BYTES": "5975387",
                "NUMBER_OF_BYTES-eng": "5975387"
            }
        },
        {
            "index": 3,
            "codec_name": "dvd_subtitle",
            "codec_long_name": "DVD subtitles",
            "codec_type": "subtitle",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "width": 1920,
            "height": 1080,
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/1000",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 7251203,
            "duration": "7251.203000",
            "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
            },
            "tags": {
                "language": "ger",
                "title": "regie kommentar",
                "_STATISTICS_WRITING_APP": "mkvmerge v7.4.0 ('Circles') 64bit built on Dec 12 2014 12:19:56",
                "_STATISTICS_WRITING_APP-eng": "mkvmerge v7.4.0 ('Circles') 64bit built on Dec 12 2014 12:19:56",
                "_STATISTICS_WRITING_DATE_UTC": "2014-12-23 23:19:28",
                "_STATISTICS_WRITING_DATE_UTC-eng": "2014-12-23 23:19:28",
                "_STATISTICS_TAGS": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES",
                "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES",
                "BPS": "17393",
                "BPS-eng": "17393",
                "DURATION": "02:00:39.595000000",
                "DURATION-eng": "02:00:39.595000000",
                "NUMBER_OF_FRAMES": "2253",
                "NUMBER_OF_FRAMES-eng": "2253",
                "NUMBER_OF_BYTES": "15740259",
                "NUMBER_OF_BYTES-eng": "15740259"
            }
        },
        {
            "index": 4,
            "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": 6,
            "channel_layout": "5.1(side)",
            "bits_per_sample": 0,
            "dmix_mode": "-1",
            "ltrt_cmixlev": "-1.000000",
            "ltrt_surmixlev": "-1.000000",
            "loro_cmixlev": "-1.000000",
            "loro_surmixlev": "-1.000000",
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/1000",
            "start_pts": 0,
            "start_time": "0.000000",
            "bit_rate": "448000",
            "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": "ger",
                "BPS": "448000",
                "BPS-eng": "448000",
                "DURATION": "02:00:49.344000000",
                "DURATION-eng": "02:00:49.344000000",
                "NUMBER_OF_FRAMES": "226542",
                "NUMBER_OF_FRAMES-eng": "226542",
                "NUMBER_OF_BYTES": "405963264",
                "NUMBER_OF_BYTES-eng": "405963264",
                "_STATISTICS_WRITING_APP": "mkvmerge v7.4.0 ('Circles') 64bit built on Dec 12 2014 12:19:56",
                "_STATISTICS_WRITING_APP-eng": "mkvmerge v7.4.0 ('Circles') 64bit built on Dec 12 2014 12:19:56",
                "_STATISTICS_WRITING_DATE_UTC": "2014-12-23 23:19:28",
                "_STATISTICS_WRITING_DATE_UTC-eng": "2014-12-23 23:19:28",
                "_STATISTICS_TAGS": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES",
                "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES"
            }
        }
    ],
    "format": {
        "filename": "video.mkv",
        "nb_streams": 5,
        "nb_programs": 0,
        "format_name": "matroska,webm",
        "format_long_name": "Matroska / WebM",
        "start_time": "0.000000",
        "duration": "7251.203000",
        "size": "5744751308",
        "bit_rate": "6337984",
        "probe_score": 100,
        "tags": {
            "encoder": "libebml v1.3.0 + libmatroska v1.4.1",
            "creation_time": "2014-12-23T23:19:28.000000Z"
        }
    }
}

How to reproduce:

% ffmpeg.exe -y -loglevel error -stats -nostdin -hide_banner -threads 8 -i video.mkv -map 0:0 -map 0:4 -map 0:1 -codec:0 copy -disposition:0 forced -metadata:s:0 language=und -codec:4 copy -metadata:s:4 language=ger -disposition:4 default -codec:1 copy -f matroska out.mkv
ffmpeg version 4.4.1-essentials_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Change History (3)

comment:1 by Markus Hempel, 2 years ago

Component: undeterminedffmpeg
Version: unspecified4.4.1

comment:2 by mkver, 2 years ago

Resolution: invalid
Status: newclosed

The stream specifier that you have to use with -codec are for your output file, not the input file. The order of streams in your output file is determined by the order of the map options: Output stream #0 is your video stream, output stream #1 is your audio and output stream #2 is the first dvd subtitle stream (input stream #1). -codec:0 copy copies the video stream, -codec:1 copy copies output stream #1, i.e. the audio stream (but was apparently meant to copy the subtitle stream) whereas -codec:4 copy does not match any stream as there are only three output streams. Output stream #2 does not have an explicitly set -codec, so it is tried to convert it to ass (which is the default subtitle codec for Matroska). And this leads to the error message you get.
Given that you don't want to reencode at all, you can just use -c copy which applies to all output streams. Or you can use -codec:2 copy.

comment:3 by Carl Eugen Hoyos, 20 months ago

Component: ffmpegundetermined
Keywords: subtitles removed
Version: 4.4.1unspecified
Note: See TracTickets for help on using tickets.