spaam / svtplay-dl

Small command-line program to download videos from some streaming sites.
https://svtplay-dl.se
MIT License
731 stars 123 forks source link

version 2.4+20.g0826b8f ignores subtitles in the merge process #1158

Open iwconfig opened 5 years ago

iwconfig commented 5 years ago

Hellö,

I installed the bleeding edge of svtplay-dl (2.4+20.g0826b8f) and noticed that after a merge the subtitle is missing. svtplay-dl downloadeds the subtitle, and the language is determined, but it is not merged.

ffprobe and mpv verifies this.

So, with regards to recent changes i tried with the latest release version (2.4) and it works as expected.

spaam commented 5 years ago

you only used -M ? or what arguments did you use?

Sopor commented 5 years ago

It worked for me

svtplay-dl.exe -S -M https://www.svtplay.se/video/23705406/uppdrag-granskning/uppdrag-granskning-sasong-20-ung-och-kriminell
INFO: Outfile: uppdrag-granskning.ung-och-kriminell-0ce8a5c-svtplay.srt
INFO: Selected to download hls, bitrate: 3153
INFO: Outfile: uppdrag-granskning.ung-och-kriminell-0ce8a5c-svtplay.audio.ts
[354/354][================================================================================] ETA: 0:00:00
INFO: Outfile: uppdrag-granskning.ung-och-kriminell-0ce8a5c-svtplay.ts
[354/354][================================================================================] ETA: 0:00:00
INFO: Merge audio, video and subtitle into uppdrag-granskning.ung-och-kriminell-0ce8a5c-svtplay.ts
INFO: Determining the language of the subtitle.
INFO: Language code: swe
INFO: Merging done, removing old files.
INFO: Muxing uppdrag-granskning.ung-och-kriminell-0ce8a5c-svtplay.ts and merging its subtitle into uppdrag-granskning.ung-och-kriminell-0ce8a5c-svtplay.mp4
INFO: Determining the language of the subtitle.
INFO: Language code: swe
INFO: Muxing done, removing the old file.

And i have tested the video and it is including the subtitles.

iwconfig commented 5 years ago

yes, only -M besides -q. Just now i also verified the other subtitle options together with -M which gave the same results. Version 2.4+20.g0826b8f does not work for me. Only 2.4.

(blah) iwconfig@debian:/tmp/blah/svtplay-dl-2.4$ ffmpeg -version
ffmpeg version 4.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
libavutil      56. 22.100 / 56. 22.100
libavcodec     58. 35.100 / 58. 35.100
libavformat    58. 20.100 / 58. 20.100
libavdevice    58.  5.100 / 58.  5.100
libavfilter     7. 40.101 /  7. 40.101
libswscale      5.  3.100 /  5.  3.100
libswresample   3.  3.100 /  3.  3.100
libpostproc    55.  3.100 / 55.  3.100

What version of svtplay-dl are you running @Sopor ?

Sopor commented 5 years ago

@iwconfig svtplay-dl 2.4-20-g0826b8f

Sopor commented 5 years ago

It seems that -M will download the subtitle but it will not merge it. To merge it you need to use -S and -M, so something is not right here.

Sopor commented 5 years ago

Ohh, it won't even download the subtitle. It only tries to merge it...

svtplay-dl.exe -M https://www.svtplay.se/video/23705406/uppdrag-granskning/uppdrag-granskning-sasong-20-ung-och-kriminell
INFO: Outfile: uppdrag-granskning.ung-och-kriminell-0ce8a5c-svtplay.srt
INFO: Selected to download hls, bitrate: 3153
INFO: Outfile: uppdrag-granskning.ung-och-kriminell-0ce8a5c-svtplay.audio.ts
[354/354][================================================================================] ETA: 0:00:00
INFO: Outfile: uppdrag-granskning.ung-och-kriminell-0ce8a5c-svtplay.ts
[354/354][================================================================================] ETA: 0:00:00
INFO: Merge audio, video and subtitle into uppdrag-granskning.ung-och-kriminell-0ce8a5c-svtplay.ts
INFO: Determining the language of the subtitle.
INFO: Language code: swe
INFO: Merging done, removing old files.
INFO: Muxing uppdrag-granskning.ung-och-kriminell-0ce8a5c-svtplay.ts and merging its subtitle into uppdrag-granskning.ung-och-kriminell-0ce8a5c-svtplay.mp4
INFO: Determining the language of the subtitle.
Traceback (most recent call last):
  File "C:\Python35\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 40, in run
  File "C:\Python35\lib\site-packages\cx_Freeze\initscripts\Console.py", line 23, in run
  File "bin/svtplay-dl", line 7, in <module>
  File "c:\projects\svtplay-dl\lib\svtplay_dl\__init__.py", line 69, in main
    except (yaml.YAMLError, yaml.MarkedYAMLError) as e:
  File "c:\projects\svtplay-dl\lib\svtplay_dl\utils\getmedia.py", line 61, in get_media

  File "c:\projects\svtplay-dl\lib\svtplay_dl\utils\getmedia.py", line 230, in get_one_media
  File "c:\projects\svtplay-dl\lib\svtplay_dl\postprocess\__init__.py", line 61, in remux
    return 'und'
  File "c:\projects\svtplay-dl\lib\svtplay_dl\postprocess\__init__.py", line 252, in _sublanguage
  File "c:\projects\svtplay-dl\lib\svtplay_dl\postprocess\__init__.py", line 210, in query
    subfile = "{0}.srt".format(name + subfix)
  File "c:\projects\svtplay-dl\lib\svtplay_dl\postprocess\__init__.py", line 204, in parse
    logging.info("Merging done, removing old files.")
FileNotFoundError: [Errno 2] No such file or directory: 'uppdrag-granskning.ung-och-kriminell-0ce8a5c-svtplay.srt'

In the folder i only have uppdrag-granskning.ung-och-kriminell-0ce8a5c-svtplay.ts

iwconfig commented 5 years ago

Also, this might be another issue, but i noticed in Sopor's output it determine the language twice when downloading a HLS source. I tried doing this, but with only -M set. In the second call to ffmpeg (merge, after the remux), svtplay-dl (and not ffmpeg) complains about not finding the subtitle. Maybe this is the reason why. Although, it is strange that ffmpeg is not complaining when downloading a DASH source which only calls ffmpeg once in the merge process.

iwconfig commented 5 years ago

Yeah, i think @Sopor is talking about the same thing. But as i said, this is not the case with DASH sources which only require the merge function

spaam commented 5 years ago

the whole postprocess is a mess. it have so much duplicated code and we do the same thing on both steps more or less :(

iwconfig commented 5 years ago

Yeah, that figures. Alright, i'll have a look at it if i ever get any time to spare, heh

spaam commented 5 years ago

there is some issues: 1) using -M and ts with separated audio and video. it crashes because the .srt file is missing in the remux step. work around is to add -S to fix it. we are doing the remux stuff in the merge step too. so we try to do it twice for some reason.. 2) . when using urplay and download all the subtitles. the output name is so wrong beacuse it include the subtitle type as a episodename. i regret doing it. need to find a better way to do it.

1). feels like both remux and merge should be same step. then based on different conditions we do stuff.. 2) i dont know how to deal with that.