shaka-project / shaka-streamer

A simple config-file based approach to preparing streaming media, based on FFmpeg and Shaka Packager.
https://shaka-project.github.io/shaka-streamer/
Apache License 2.0
198 stars 62 forks source link

Error when using URL as file name #97

Closed hazem-jday closed 3 years ago

hazem-jday commented 3 years ago

When using URL as file name, (name filed in vod input for example) shaka streamer can't stream anymore, It's a new problem related to new commits !

mariocynicys commented 3 years ago

Hey @HazemJday , Would you please provide more info about this as I couldn't reproduce this bug from master. What was the error Shaka Streamer produced?

You can set the debug_logs in the pipeline configuration to true, this will dump FFmpeg's and Shaka Packager's logs to log files. Dump these logs here in a comment along with Shaka Streamer's stdout so we can figure out what caused the error. You can also share the input and pipeline configuration you used to produced this bug.

hazem-jday commented 3 years ago

Hey @meryacine

when I run shaka-streamer like that :

python3 shaka-streamer -i config_files/input_vod_config.yaml -p config_files/pipeline_vod_config.yaml -o output

if i use as input, a local video file (inputs name is the file path), it works perfectly, example (file in the same directory):

inputs:
  - name: Sintel.2010.720p.mkv
  ...

But when i use file URL, example:

inputs:
  - name: https://storage.googleapis.com/shaka-streamer-assets/sample-inputs/Sintel.2010.720p.mkv
  ...

I will have this logs :

+ /home/dell/.local/lib/python3.8/site-packages/streamer_binaries/ffprobe-linux-x64 https://storage.googleapis.com/shaka-streamer-assets/sample-inputs/Sintel.2010.720p.mkv -select_streams v:0 -show_entries stream=index -of compact=p=0:nk=1
Traceback (most recent call last):
  File "shaka-streamer", line 125, in <module>
    sys.exit(main())
  File "shaka-streamer", line 104, in main
    with controller.start(args.output, input_config_dict, pipeline_config_dict,
  File "/home/dell/shaka-streamer/streamer/controller_node.py", line 179, in start
    self._input_config = InputConfig(input_config_dict)
  File "/home/dell/shaka-streamer/streamer/input_configuration.py", line 405, in __init__
    super().__init__(dictionary)
  File "/home/dell/shaka-streamer/streamer/configuration.py", line 325, in __init__
    value = self._check_and_convert_type(field, key, value)
  File "/home/dell/shaka-streamer/streamer/configuration.py", line 381, in _check_and_convert_type
    return [self._check_and_convert_type(subfield, key, v) for v in value]
  File "/home/dell/shaka-streamer/streamer/configuration.py", line 381, in <listcomp>
    return [self._check_and_convert_type(subfield, key, v) for v in value]
  File "/home/dell/shaka-streamer/streamer/configuration.py", line 368, in _check_and_convert_type
    sub_object = field.type(value)
  File "/home/dell/shaka-streamer/streamer/input_configuration.py", line 222, in __init__
    if not autodetect.is_present(self):
  File "/home/dell/shaka-streamer/streamer/autodetect.py", line 88, in is_present
    return bool(_probe(input, 'stream=index') or
  File "/home/dell/shaka-streamer/streamer/autodetect.py", line 70, in _probe
    output_bytes: bytes = subprocess.check_output(args, stderr=subprocess.DEVNULL)
  File "/usr/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/home/dell/.local/lib/python3.8/site-packages/streamer_binaries/ffprobe-linux-x64', 'https://storage.googleapis.com/shaka-streamer-assets/sample-inputs/Sintel.2010.720p.mkv', '-select_streams', 'v:0', '-show_entries', 'stream=index', '-of', 'compact=p=0:nk=1']' returned non-zero exit status 1.

This error appeared after the latest commits, I was able to use file URL before..

I attached the input and pipeline config files here..

Thanks, config_files.zip

mariocynicys commented 3 years ago

@HazemJday It turns out that the version of FFprobe shipped in streamer_binaries package doesn't support https protocol.

/home/omar/.local/lib/python3.8/site-packages/streamer_binaries/ffprobe-linux-x64 https://storage.googleapis.com/shaka-streamer-assets/sample-inputs/Sintel.2010.720p.mkv -select_streams v:0 -show_entries stream=index -of compact=p=0:nk=1
ffprobe version n4.4 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --pkg-config-flags=--static --disable-ffplay --enable-libvpx --enable-libaom --enable-libx264 --enable-libx265 --enable-libmp3lame --enable-libopus --enable-runtime-cpudetect --enable-gpl --enable-version3 --enable-static --enable-nvenc --enable-vdpau
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
https protocol not found, recompile FFmpeg with openssl, gnutls or securetransport enabled.
https://storage.googleapis.com/shaka-streamer-assets/sample-inputs/Sintel.2010.720p.mkv: Protocol not found

You can see the error says FFprobe should be recompiled with openssl enabled to support an https input. A quick fix for this is to use the version of FFprobe you have installed in your PATH by running your command again but with --use-system-binaries option, so it would be like this:

python3 shaka-streamer -i config_files/input_vod_config.yaml -p config_files/pipeline_vod_config.yaml -o output --use-system-binaries

I have opened an issue about this in the repo that is used to produce the static binaries in shaka-streamer-binaries package.

hazem-jday commented 3 years ago

@meryacine Thank you

joeyparrish commented 3 years ago

This should have been resolved by our most recent releases. Please try upgrading to see if this resolves the issue for you:

pip install --upgrade shaka-streamer shaka-streamer-binaries

Thanks!