emk / subtitles-rs

Use SRT subtitle files to study foreign languages (in progress)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ExpectedError("Number", "-99")

swedeeee opened this issue · comments

I'm trying to export my mkv to csv using the given command substudy export csv episode_07_01.mkv \ episode_07_01.fr.srt episode_07_01.en.srt but I can't seem to get it working. I get ExpectedError("Number", "-99").

I'm having no problems using the combine code for the bilingual subtitles. I just can't seem to get the export working for the life of me..

Sorry about this!

Try setting export RUST_LOG=substudy=trace in your environment and posting logs. Also try searching through your *.srt files for "-99" and editing them by hand to get rid of any offending lines.

(Actually, if you do find any offending lines, please post them, so I can see if there's any way to fix the parser.)

Hey,

Had a look through the .srt files and couldn't find anything for "-99", ran the command with the trace and got the following:

kent$ substudy export csv episode_07_01.mkv \ episode_07_01.fr.srt episode_07_01.en.srt
DEBUG:substudy::video: Video metadata: {
    "streams": [
        {
            "index": 0,
            "codec_name": "mpeg2video",
            "codec_long_name": "MPEG-2 video",
            "profile": "Main",
            "codec_type": "video",
            "codec_time_base": "1/50",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "width": 720,
            "height": 576,
            "coded_width": 0,
            "coded_height": 0,
            "has_b_frames": 1,
            "sample_aspect_ratio": "64:45",
            "display_aspect_ratio": "16:9",
            "pix_fmt": "yuv420p",
            "level": 8,
            "color_range": "tv",
            "chroma_location": "left",
            "field_order": "tt",
            "refs": 1,
            "r_frame_rate": "50/1",
            "avg_frame_rate": "50/1",
            "time_base": "1/1000",
            "start_pts": 0,
            "start_time": "0.000000",
            "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": {
                "BPS": "2915936",
                "BPS-eng": "2915936",
                "DURATION": "00:49:57.000000000",
                "DURATION-eng": "00:49:57.000000000",
                "NUMBER_OF_FRAMES": "74925",
                "NUMBER_OF_FRAMES-eng": "74925",
                "NUMBER_OF_BYTES": "1092382599",
                "NUMBER_OF_BYTES-eng": "1092382599",
                "_STATISTICS_WRITING_APP": "mkvmerge v17.0.0 ('Be Ur Friend') 64-bit",
                "_STATISTICS_WRITING_APP-eng": "mkvmerge v17.0.0 ('Be Ur Friend') 64-bit",
                "_STATISTICS_WRITING_DATE_UTC": "2017-10-22 05:23:06",
                "_STATISTICS_WRITING_DATE_UTC-eng": "2017-10-22 05:23:06",
                "_STATISTICS_TAGS": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES",
                "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES"
            }
        },
        {
            "index": 1,
            "codec_name": "mp2",
            "codec_long_name": "MP2 (MPEG audio layer 2)",
            "codec_type": "audio",
            "codec_time_base": "1/48000",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "sample_fmt": "s16p",
            "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": 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
            },
            "tags": {
                "language": "fre",
                "BPS": "192000",
                "BPS-eng": "192000",
                "DURATION": "00:49:57.000000000",
                "DURATION-eng": "00:49:57.000000000",
                "NUMBER_OF_FRAMES": "124875",
                "NUMBER_OF_FRAMES-eng": "124875",
                "NUMBER_OF_BYTES": "71928000",
                "NUMBER_OF_BYTES-eng": "71928000",
                "_STATISTICS_WRITING_APP": "mkvmerge v17.0.0 ('Be Ur Friend') 64-bit",
                "_STATISTICS_WRITING_APP-eng": "mkvmerge v17.0.0 ('Be Ur Friend') 64-bit",
                "_STATISTICS_WRITING_DATE_UTC": "2017-10-22 05:23:06",
                "_STATISTICS_WRITING_DATE_UTC-eng": "2017-10-22 05:23:06",
                "_STATISTICS_TAGS": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES",
                "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES"
            }
        },
        {
            "index": 2,
            "codec_name": "mjpeg",
            "codec_long_name": "Motion JPEG",
            "codec_type": "video",
            "codec_time_base": "0/1",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "width": 600,
            "height": 859,
            "coded_width": 600,
            "coded_height": 859,
            "has_b_frames": 0,
            "sample_aspect_ratio": "0:1",
            "display_aspect_ratio": "0:1",
            "pix_fmt": "yuvj444p",
            "level": -99,
            "color_range": "pc",
            "color_space": "bt470bg",
            "chroma_location": "center",
            "refs": 1,
            "r_frame_rate": "90000/1",
            "avg_frame_rate": "0/0",
            "time_base": "1/90000",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 269730000,
            "duration": "2997.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": 1,
                "timed_thumbnails": 0
            },
            "tags": {
                "filename": "cover.jpg",
                "mimetype": "image/jpeg"
            }
        },
        {
            "index": 3,
            "codec_name": "mjpeg",
            "codec_long_name": "Motion JPEG",
            "codec_type": "video",
            "codec_time_base": "0/1",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "width": 120,
            "height": 172,
            "coded_width": 120,
            "coded_height": 172,
            "has_b_frames": 0,
            "sample_aspect_ratio": "0:1",
            "display_aspect_ratio": "0:1",
            "pix_fmt": "yuvj444p",
            "level": -99,
            "color_range": "pc",
            "color_space": "bt470bg",
            "chroma_location": "center",
            "refs": 1,
            "r_frame_rate": "90000/1",
            "avg_frame_rate": "0/0",
            "time_base": "1/90000",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 269730000,
            "duration": "2997.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": 1,
                "timed_thumbnails": 0
            },
            "tags": {
                "filename": "small_cover.jpg",
                "mimetype": "image/jpeg"
            }
        }
    ]
}

ExpectedError("Number", "-99")

I see that "level" is -99

I see that "level" is -99

Yup, that's almost certainly it.

Probably the fix is to remove this line, recompile using cargo install -f, and see if it works. Do you know how to fork a repository on GitHub, download it, and make a change?

I can look into this later, but this week is ridiculously busy, and I thought I should at least offer to point you in the right direction.

Hey, no problem, thanks for the help anyway! I forked the repository, downloaded it and deleted the line. I'm a bit clueless when it comes to the recompile phase - I just went into the forked repository folder on my desktop using cd and put cargo install -f.

I entered the export csv command again and gotNo such file or directory (os error 2). I think probably did something wrong during the recompiling phase, no experience doing this type of thing. Anyway, thanks again.

Don't worry, no problems!

I've updated substudy to v0.4.3 and fixed this bug. You can install it using cargo install -f substudy. But I think the No such file or directory (os error 2) is caused by still being cded into the substudy/ directory instead of the directory with your *.srt and *.mov files.

Cheers Emk, it's working. Thanks for your help again it's very much appreciated.