cbusillo / BD_to_AVP

3D Blu-ray to Apple Vision Pro converter
GNU General Public License v3.0
99 stars 5 forks source link

conversion from MKV file fails if ":" is in the filename #1

Closed tachijuan closed 8 months ago

tachijuan commented 8 months ago

I have an ISO that I'm converting. Looks like the metadata of the ISO has a colon in the name of the video. That name is being used as the name of the folder and the converted file. However, ffmpeg has an issue with the conversion if the name has a colon. I had to edit the main python file to turn on verbose on the ffmpeg run call:

        ffmpeg.run(
            [video_stream, audio_stream, subtitle_stream],
            overwrite_output=True,
            quiet=False
        )

That gave me this error (slightly obfuscating file name):

[out#0/sup @ 0x6000000e15c0] Error opening output Movie: Title 3D/Movie: Title 3D_subtitle.sup: Protocol not found
Error opening output file Movie: Title 3D/Movie: Title 3D_subtitle.sup.
Error opening output files: Protocol not found

Apparently this is a known issue with ffmpeg according to this thread: https://unix.stackexchange.com/questions/412519/ffmpeg-protocol-not-found-for-normal-file-name

cbusillo commented 8 months ago

It looks like the right way to handle this is to add file: before the file name. I’ll add this when I get home shortly.

By chance have you converted anything with a period in the name yet?

tachijuan commented 8 months ago

i have not yet. Ran into the above problem with my very first conversion. The second one that didn't have a colon in it worked. That one does not have a period in it.

cbusillo commented 8 months ago

I added a file: prefix to the output of all of the FFmpeg sections. It is building and publishing now. You should be able to run the install script again to update. Let me know how it works!

tachijuan commented 8 months ago

That worked. Thank you.

tachijuan commented 8 months ago

well - I spoke too soon:

  File "/Users/juan/.bd_to_avp_venv/lib/python3.12/site-packages/bd_to_avp/main.py", line 876, in create_mvc_audio_and_subtitle_files
    subtitle_output_path = convert_sup_to_idx(subtitle_output_path)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/juan/.bd_to_avp_venv/lib/python3.12/site-packages/bd_to_avp/main.py", line 893, in convert_sup_to_idx
    ffmpeg.run(subtitle_stream, overwrite_output=True, quiet=True)
  File "/Users/juan/.bd_to_avp_venv/lib/python3.12/site-packages/ffmpeg/_run.py", line 325, in run
    raise Error('ffmpeg', out, err)
ffmpeg._run.Error: ffmpeg error (see stderr output for detail)

anything I can give you to help diagnose?

cbusillo commented 8 months ago

Can you make sure you have the latest version? I checked and that section does indeed have the file: before the output file to avoid issues with the colon.

tachijuan commented 8 months ago

I was pretty sure but ran it again:

    Chapter #1:19: start 7083.659917, end 7508.704000
      Metadata:
        title           : Chapter 20
  Stream #1:0(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 7.1, s32, 9216 kb/s (default)
    Metadata:
      title           : Surround 7.1
      BPS-eng         : 5731354
      DURATION-eng    : 02:05:08.682666666
      NUMBER_OF_FRAMES-eng: 703939
      NUMBER_OF_BYTES-eng: 5379365088
      SOURCE_ID-eng   : 001100
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.17.6 darwin(arm64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2024-03-21 19:45:06
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
      encoder         : Lavc60.31.102 pcm_s24le
[out#0/sup @ 0x6000034ac000] video:0kB audio:0kB subtitle:22221kB other streams:0kB global headers:0kB muxing overhead: 0.428219%
[out#1/mov @ 0x6000034a0000] video:0kB audio:8447268kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000794%
[out#2/h264 @ 0x6000034a0240] video:34186619kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
size=   22317kB time=02:05:08.67 bitrate=  24.3kbits/s speed=2.03x
Traceback (most recent call last):
  File "/opt/homebrew/bin/bd-to-avp", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/juan/.bd_to_avp_venv/lib/python3.12/site-packages/bd_to_avp/main.py", line 698, in main
    process_each(input_args)
  File "/Users/juan/.bd_to_avp_venv/lib/python3.12/site-packages/bd_to_avp/main.py", line 732, in process_each
    create_mvc_audio_and_subtitle_files(
  File "/Users/juan/.bd_to_avp_venv/lib/python3.12/site-packages/bd_to_avp/main.py", line 876, in create_mvc_audio_and_subtitle_files
    subtitle_output_path = convert_sup_to_idx(subtitle_output_path)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/juan/.bd_to_avp_venv/lib/python3.12/site-packages/bd_to_avp/main.py", line 893, in convert_sup_to_idx
    ffmpeg.run(subtitle_stream, overwrite_output=True, quiet=True)
  File "/Users/juan/.bd_to_avp_venv/lib/python3.12/site-packages/ffmpeg/_run.py", line 325, in run
    raise Error('ffmpeg', out, err)
ffmpeg._run.Error: ffmpeg error (see stderr output for detail)
cbusillo commented 8 months ago

I added logging for ffmpeg when it fails, if you are testing from mkv, it should be quick, if you are starting from ISO, you should be able to use --start-stage EXTRACT_MVC_AUDIO_AND_SUB to continue where you left off. New version should be up. Just to be clear, you were able to encode the discs with a colon in the name and it's the one with a colon that is giving us issues?

cbusillo commented 8 months ago

Also just pushed a version that strips anything other than bcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 _- from the title. People were having issues with discs with quotes and things in the title causing filename problems

cbusillo commented 8 months ago

@tachijuan If you have time to test the new version that strips out bad characters, please let me know the results :)

tachijuan commented 8 months ago

I started it this morning before I left for work. Came back and it completed successfully.

cbusillo commented 8 months ago

Awesome! Let me know if you have any other issues.