Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

youtube-dl piping to vlc works on ubuntu but fails on WSL #26525

Closed
Genius1237 opened this issue Sep 4, 2020 · 4 comments
Closed

youtube-dl piping to vlc works on ubuntu but fails on WSL #26525

Genius1237 opened this issue Sep 4, 2020 · 4 comments

Comments

@Genius1237
Copy link

@Genius1237 Genius1237 commented Sep 4, 2020

Checklist

  • I'm reporting a broken site support issue
  • I've verified that I'm running youtube-dl version 2020.07.28
  • I've checked that all provided URLs are alive and playable in a browser
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar bug reports including closed ones
  • I've read bugs section in FAQ

Verbose log

VLC media player 3.0.8 Vetinari (revision 3.0.8-0-gf350b6b5a7)
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', 'https://live-hls-web-aje.getaj.net/AJE/index.m3u8', '-o', '-']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.07.28
[debug] Python version 3.6.10 (CPython) - Linux-4.19.104-microsoft-standard-x86_64-with-debian-buster-sid
[debug] exe versions: ffmpeg 3.4.8, ffprobe 3.4.8
[debug] Proxy map: {}
[generic] index: Requesting header
[generic] index: Downloading m3u8 information
[debug] Default format spec: best/bestvideo+bestaudio
[debug] Invoking downloader on 'https://live-hls-web-aje.getaj.net/AJE/01.m3u8'
[download] Destination: -
[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/73.0.3666.1 Safari/537.36
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: en-us,en;q=0.5
' -i https://live-hls-web-aje.getaj.net/AJE/01.m3u8 -c copy -f mpegts -
ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
[hls,applehttp @ 0x561e2f5316e0] HLS request for url 'https://live-hls-web-aje.getaj.net/AJE/20190710T110056-01-5833901.ts', offset 0, playlist 0
[hls,applehttp @ 0x561e2f5316e0] Opening 'https://live-hls-web-aje.getaj.net/AJE/20190710T110056-01-5833901.ts' for reading
[h264 @ 0x561e2f885260] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 0x561e2f885260] Increasing reorder buffer to 1
[h264 @ 0x561e2f885260] Increasing reorder buffer to 2
Input #0, hls,applehttp, from 'https://live-hls-web-aje.getaj.net/AJE/01.m3u8':
  Duration: N/A, start: 7817.849356, bitrate: N/A
  Program 0
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Video: h264 (High), 1 reference frame ([27][0][0][0] / 0x001B), yuv420p(tv, left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Metadata:
      variant_bitrate : 0
    Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp
    Metadata:
      variant_bitrate : 0
[mpegts @ 0x561e2f8839e0] muxrate VBR, pcr every 9000 pkts, sdt every 200, pat/pmt every 40 pkts
Output #0, mpegts, to 'pipe:':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Video: h264 (High), 1 reference frame ([27][0][0][0] / 0x001B), yuv420p(tv, left), 1920x1080 (0x0) [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 90k tbn, 90k tbc
    Metadata:
      variant_bitrate : 0
    Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp
    Metadata:
      variant_bitrate : 0
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help


ERROR: ffmpeg exited with code -13
  File "/home/t-ansrin/miniconda3/envs/py36/bin/youtube-dl", line 8, in <module>
    sys.exit(main())
  File "/home/t-ansrin/miniconda3/envs/py36/lib/python3.6/site-packages/youtube_dl/__init__.py", line 474, in main
    _real_main(argv)
  File "/home/t-ansrin/miniconda3/envs/py36/lib/python3.6/site-packages/youtube_dl/__init__.py", line 464, in _real_main
    retcode = ydl.download(all_urls)
  File "/home/t-ansrin/miniconda3/envs/py36/lib/python3.6/site-packages/youtube_dl/YoutubeDL.py", line 2019, in download
    url, force_generic_extractor=self.params.get('force_generic_extractor', False))
  File "/home/t-ansrin/miniconda3/envs/py36/lib/python3.6/site-packages/youtube_dl/YoutubeDL.py", line 808, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/home/t-ansrin/miniconda3/envs/py36/lib/python3.6/site-packages/youtube_dl/YoutubeDL.py", line 863, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/home/t-ansrin/miniconda3/envs/py36/lib/python3.6/site-packages/youtube_dl/YoutubeDL.py", line 1644, in process_video_result
    self.process_info(new_info)
  File "/home/t-ansrin/miniconda3/envs/py36/lib/python3.6/site-packages/youtube_dl/YoutubeDL.py", line 1926, in process_info
    success = dl(filename, info_dict)
  File "/home/t-ansrin/miniconda3/envs/py36/lib/python3.6/site-packages/youtube_dl/YoutubeDL.py", line 1865, in dl
    return fd.download(name, info)
  File "/home/t-ansrin/miniconda3/envs/py36/lib/python3.6/site-packages/youtube_dl/downloader/common.py", line 366, in download
    return self.real_download(filename, info_dict)
  File "/home/t-ansrin/miniconda3/envs/py36/lib/python3.6/site-packages/youtube_dl/downloader/external.py", line 64, in real_download
    self.get_basename(), retval))
  File "/home/t-ansrin/miniconda3/envs/py36/lib/python3.6/site-packages/youtube_dl/downloader/common.py", line 165, in report_error
    self.ydl.report_error(*args, **kargs)
  File "/home/t-ansrin/miniconda3/envs/py36/lib/python3.6/site-packages/youtube_dl/YoutubeDL.py", line 625, in report_error
    self.trouble(error_message, tb)
  File "/home/t-ansrin/miniconda3/envs/py36/lib/python3.6/site-packages/youtube_dl/YoutubeDL.py", line 587, in trouble
    tb_data = traceback.format_list(traceback.extract_stack())

Description

Command run

youtube-dl -v https://live-hls-web-aje.getaj.net/AJE/index.m3u8 -o - | cvlc --sout "#standard{access=http,mux=ts,dst=0.0.0.0
:8080}" -

I am using youtube-dl to download a HLS stream on the fly and stream it over my network using VLC. The standard method for piping youtube-dl to vlc is as follows: youtube-dl URL -o - | vlc - and I am using it. On a ubuntu desktop system of mine, this works successfully. However, on a WSL2 (with ubuntu as the distro), I get this error with FFMPEG. I have the latest version of youtube-dl from pip and ffmpeg from my distro's repos. To add, if I run youtube-dl without piping it to VLC, it runs fine. The error with ffmpeg only appears when it is piped to vlc.

I would really appreciate it if someone is able to look into this, or atleast guide me on how to investigate this myself.

@blackjack4494
Copy link

@blackjack4494 blackjack4494 commented Sep 4, 2020

Seems permission related. What kind of user are you using? Have you tried sudo?

@Genius1237
Copy link
Author

@Genius1237 Genius1237 commented Sep 4, 2020

I am running as a normal user. I tried running both youtube-dl and vlc with sudo and there is no difference.

Would it be able to identify what the actual error with ffmpeg is? The current error message ERROR: ffmpeg exited with code -13 is pretty uninformative. Not able to find anything for this error code on google.

@blackjack4494
Copy link

@blackjack4494 blackjack4494 commented Sep 4, 2020

That is depending on your OS. In Ubuntu errno.h 13 should be a permission issues. Don't worry about the '-' before the error code. Back then it was common to use positive and negative to signal respectively success or failure.

@Genius1237
Copy link
Author

@Genius1237 Genius1237 commented Sep 4, 2020

Interesting. Since you say that ffmpeg is having issues writing to a pipe, I decided to do some digging on my own. vlc was failing to stream .mp4 files that I'd manually downloaded as well.

To get a "headless" vlc install, I'd installed the vlc-bin package alone. Turns out that this doesn't have all the features for streaming and it needs vlc-plugin-base installed as well. After installing this, everything is working as expected.

On a side note, I thought that a popular package like vlc would have instructions for a headless/server install, but it doesn't. Hand to manually dig and install the packages that were needed.

@Genius1237 Genius1237 closed this Sep 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.