oleksis / youtube-dl-gui

A cross platform front-end GUI of the popular youtube-dl written in wxPython.
https://oleksis.github.io/youtube-dl-gui/
The Unlicense
1.59k stars 102 forks source link

yt-dlg 1.8.3 .rpm on openSUSE - Live Stream Bug #111

Open Spirograph12 opened 1 year ago

Spirograph12 commented 1 year ago

Please follow the guide below

WARNING

All invalid issues will be rejected!!

Before going further

What is the purpose of your issue?

Bug report

If the problem occurs when downloading a URL please provide the full verbose output as follows:

  1. Restart yt-dlg
  2. Go to Options > Extra tab
  3. Enable Debug youtube-dl
  4. Go to Options > Advanced tab and Clear your log content
  5. Try to download the URL
  6. Copy the whole log content and insert it between the ``` part below
2022-12-18 13:38:34,301-DEBUG-Worker_1-[debug] Command-line config: ['--newline', '-i', '--restrict-filenames', '-o', '/home/ralph/%(title)s-%(id)s.ts', '-v', '--ignore-config', '--downloader', 'ffmpeg', '--hls-use-mpegts', '--no-part', 'https://www.cbsnews.com/live/']
2022-12-18 13:38:34,301-DEBUG-Worker_1-[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8 (No ANSI), error utf-8 (No ANSI), screen utf-8 (No ANSI)
2022-12-18 13:38:34,302-DEBUG-Worker_1-[debug] yt-dlp version 2022.11.11 [8b64402] (zip)
2022-12-18 13:38:34,302-DEBUG-Worker_1-[debug] Python 3.10.8 (CPython x86_64 64bit) - Linux-6.0.10-1-default-x86_64-with-glibc2.36 (OpenSSL 1.1.1s  1 Nov 2022, glibc 2.36)
2022-12-18 13:38:34,302-DEBUG-Worker_1-[debug] exe versions: ffmpeg 4.4.3 (fdk,setts), ffprobe 4.4.3
2022-12-18 13:38:34,302-DEBUG-Worker_1-[debug] Optional libraries: Crypto-3.16.0, brotli-1.0.9, certifi-2022.09.24, sqlite3-2.6.0
2022-12-18 13:38:34,303-DEBUG-Worker_1-[debug] Proxy map: {}
2022-12-18 13:38:34,303-DEBUG-Worker_1-[debug] Loaded 1723 extractors
2022-12-18 13:38:34,303-DEBUG-Worker_1-[debug] [generic] Extracting URL: https://www.cbsnews.com/live/
2022-12-18 13:38:34,303-DEBUG-Worker_1-WARNING: [generic] Falling back on generic information extractor
2022-12-18 13:38:34,304-DEBUG-Worker_1-[debug] Looking for embeds
2022-12-18 13:38:34,304-DEBUG-Worker_1-[debug] Identified a Twitter card
2022-12-18 13:38:34,304-DEBUG-Worker_1-[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
2022-12-18 13:38:34,304-DEBUG-Worker_1-[debug] Default format spec: bestvideo*+bestaudio/best
2022-12-18 13:38:34,304-DEBUG-Worker_1-[debug] Invoking ffmpeg downloader on "https://cbsn-us.cbsnstream.cbsnews.com/out/v1/55a8648e8f134e82a470f83d562deeca/master_11.m3u8"
2022-12-18 13:38:34,304-DEBUG-Worker_1-[debug] ffmpeg command line: ffmpeg -y -loglevel verbose -headers 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36
2022-12-18 13:38:34,305-DEBUG-Worker_1-Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
2022-12-18 13:38:34,305-DEBUG-Worker_1-Accept-Language: en-us,en;q=0.5
2022-12-18 13:38:34,305-DEBUG-Worker_1-Sec-Fetch-Mode: navigate
2022-12-18 13:38:34,305-DEBUG-Worker_1-Referer: https://www.cbsnews.com/live/
2022-12-18 13:38:34,305-DEBUG-Worker_1-Cookie: fly_device=desktop; fly_geo={"countryCode": "US", "region": "NY", "dma": "501", "connection": { "type": "broadband"}}; CBS_INTERNAL=0
2022-12-18 13:38:34,305-DEBUG-Worker_1-' -i https://cbsn-us.cbsnstream.cbsnews.com/out/v1/55a8648e8f134e82a470f83d562deeca/master_11.m3u8 -c copy -f mpegts file:/home/ralph/CBS_News_Live-master_11.ts
2022-12-18 13:38:34,305-DEBUG-Worker_1-Child process exited with non-zero code: 1

What operating system do you use ?

This report is for: Linux openSUSE Tumbleweed python310-yt-dlg 1.8.3-1.216

List of actions to perform to reproduce the problem:

  1. Set up yt-dlg to use yt-dlp as CLI backend.

  2. In Extras tab, use recommended flags to download live streams via ffmpeg:

--downloader ffmpeg --hls-use-mpegts --no-part

  1. In Settings: Options: General: Filename format:

Choose Custom and paste this:

%(title)s %(id)s.ts

Now yt-dlg is correctly set up to download live streams as mpegts transport streams with extension .ts

  1. Start downloading a live stream. Example live streams:

https://www.cbsnews.com/live/

https://wnetdt.lls.pbs.org/out/v1/0456457548354b88b32fc437e4e7ee01/index.m3u8

https://classicarts.akamaized.net/hls/live/1024257/CAS/master.m3u8

https://playoutengine.sinclairstoryline.com/playout/9f87522c-5a0e-4ff4-b82c-d5564216132f.m3u8

https://docubayvh.s.llnwi.net/526a07ab-6ae7-4b6c-84a1-159791416484_1000004372_HLS/manifest.m3u8

What is the expected behaviour ?

Hitting the stop button should stop the download. (It should kill both yt-dlp and ffmpeg.)

What happens instead ?

Hitting the stop button has no effect. The live stream continues to download. It must be stopped manually, using killall ffmpeg or task manager.

Note 1: This is an old bug which was never fixed on Windows, but was fixed on Linux using the os.killpg function. See this comment by original developer:

https://github.com/MrS0m30n3/youtube-dl-gui/issues/49#issuecomment-121231385

I'm NOT a coder, but maybe the reason old developer was perhaps using subprocess module is that subprocess module can be more easily killed in cases where CLI backend calls ffmpeg. If you're using the CLI backend directly from python instead of using the subprocess module, maybe that's the issue.

Note 2: In the old yt-dlg 0.4 such as Ubuntu binary 0.4-1 http://ppa.launchpad.net/nilarimogard/webupd8/ubuntu/pool/main/y/youtube-dlg/youtube-dlg_0.4-1~webupd8~disco0_all.deb , hitting the stop button works as expected. ffmpeg stops downloading the live stream.

Note 3: The above yt-dlg Ubuntu binary still works in Ubuntu 20.04 with Python 3.8. Live streams downloaded using ffmpeg are successfully killed by pressing the stop button.

Note 4: Possibly at one time a workaround was to use "Prefer Native HLS". But in 2022 with yt-dlp this is not practical for live streams. To download most live streams, you need ffmpeg. Otherwise, only a short initial segment will download. Then the download will stop.

Note 5: Your FAQs file linking to old issue number 49 has typos leading to 404s. Please change youtubet to youtube (two instances).

Thank you for your time, and best wishes for a happy holiday season!

Spirograph12 commented 1 year ago

UPDATE: A guy who wrote a GUI in Qt/C++ was able to solve the ffmpeg child process issue based on tips he found here:

https://www.baeldung.com/linux/get-process-child-processes

I don't know if that helps you with your Python GUI.

oleksis commented 1 year ago

Thanks for the feedback and share the info. I will take a look 👀