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

Dcoument RTMP/RTSP input support #16

Open
joeyparrish opened this issue Sep 3, 2019 · 5 comments
Open

Dcoument RTMP/RTSP input support #16

joeyparrish opened this issue Sep 3, 2019 · 5 comments
Labels
priority: P3 Useful but not urgent type: docs Improvements or fixes to documentation
Milestone

Comments

@joeyparrish
Copy link
Member

Similar to #9 (UDP input support), we should add support for RTMP/RTSP input.

It may also be worth considering an input type that allows the user to connect an arbitrary ffmpeg command line as input, rather than adding explicit support for many various inputs types that ffmpeg supports.

@joeyparrish joeyparrish added the type: enhancement New feature or request label Sep 3, 2019
@joeyparrish
Copy link
Member Author

(Suggested by @Romantic-LiXuefeng in #15.)

@joeyparrish
Copy link
Member Author

We've just discovered through the conversation in #42 that RTMP doesn't seem to need any additional work. Just documentation.

Here's a working RTMP input config, for example:

inputs:
  - name: rtmp://localhost/live/foo
    media_type: video

  - name: rtmp://localhost/live/foo
    media_type: audio

@joeyparrish joeyparrish added type: docs Improvements or fixes to documentation and removed type: enhancement New feature or request labels Nov 8, 2019
@joeyparrish joeyparrish modified the milestones: Backlog, v1.0 Nov 8, 2019
@joeyparrish joeyparrish changed the title Add RTMP/RTSP input support Dcoument RTMP/RTSP input support Nov 19, 2019
@joeyparrish joeyparrish added the priority: P3 Useful but not urgent label Sep 29, 2021
@jspizziri
Copy link

@joeyparrish I've attempted to play around with this and it appears that some of the updates since v0.3.0 (which is the version I believe was being used at this time) have rendered rtmp non-functional.

Specifically, I think it might be related to how streamer is checking for the presence of a file here. Perhaps there needs to be a new input type added to TYPES_WE_CANT_PROBE? The only one that exists currently is external_command. But using that input_type requires several other properties on the input like frame_rate and resolution, which I'm not sure should be on an rtmp stream? Could be wrong, this is my first crack at anything in the rtmp world and I have a very minimal of understanding of video as a whole on top of that.

@jspizziri
Copy link

jspizziri commented Jun 7, 2023

I built a version of shaka-streamer locally from the v0.3.0 tag (given my earlier suspicion). I'm not able to make the above rtmp input work there either. In all cases (current version and 0.3) I ultimately get an error fromffprobe that looks something like the following:

root@010de38d22a5:/usr/src/app# python3 shaka-streamer -i config_files/input_rtmp_config.yaml -p config_files/pipeline_live_config.yaml -o /usr/src/app/output
+ ffprobe rtmp://localhost/live/commet -select_streams v:0 -show_entries stream=field_order -of compact=p=0:nk=1
Traceback (most recent call last):
  File "/usr/src/app/shaka-streamer", line 119, in <module>
    sys.exit(main())
  File "/usr/src/app/shaka-streamer", line 100, in main
    with controller.start(args.output, input_config_dict, pipeline_config_dict,
  File "/usr/src/app/streamer/controller_node.py", line 150, in start
    input_config = InputConfig(input_config_dict)
  File "/usr/src/app/streamer/configuration.py", line 247, in __init__
    value = self._check_and_convert_type(field, key, value)
  File "/usr/src/app/streamer/configuration.py", line 299, in _check_and_convert_type
    return [self._check_and_convert_type(subfield, key, v) for v in value]
  File "/usr/src/app/streamer/configuration.py", line 299, in <listcomp>
    return [self._check_and_convert_type(subfield, key, v) for v in value]
  File "/usr/src/app/streamer/configuration.py", line 286, in _check_and_convert_type
    sub_object = field.type(value)
  File "/usr/src/app/streamer/input_configuration.py", line 207, in __init__
    self.is_interlaced = autodetect.get_interlaced(self)
  File "/usr/src/app/streamer/autodetect.py", line 88, in get_interlaced
    interlaced_string = _probe(input, 'stream=field_order')
  File "/usr/src/app/streamer/autodetect.py", line 68, in _probe
    output_bytes = subprocess.check_output(args, stderr=subprocess.DEVNULL)
  File "/usr/local/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/local/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ffprobe', 'rtmp://localhost/live/commet', '-select_streams', 'v:0', '-show_entries', 'stream=field_order', '-of', 'compact=p=0:nk=1']' returned non-zero exit status 1.

I don't think I'm passing the config incorrectly as it's pretty clearly documented in this and other issues. So perhaps it's a problem with the newer version of ffprobe or there's some other unknown thing that I'm doing wrong.

@jspizziri
Copy link

jspizziri commented Jun 7, 2023

Alright, so I think the issue is the result of my n00bery. I didn't realize that I needed a proxy between the publisher of the RTMP stream and the shaka-streamer process (I suppose I thought there was magic in the streamer that handled what effectively is the proxy layer). I now have a simple nginx proxy between my publisher (in my case OBS) and my local streamer. The probe error is now gone, however I'm getting another error like:

Input is missing a required field: resolution, a VideoResolution name (one of '144p', '240p', '360p', '480p', '576p', '720p', '720p-hfr', '1080p', '1080p-hfr', '1440p', '1440p-hfr', '4k', '4k-hfr', '8k', '8k-hfr')

But I'm guessing that is a problem with how I'm streaming. Sorry for the unnecessary chatter as I learn. Hopefully it will be helpful to someone else :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: P3 Useful but not urgent type: docs Improvements or fixes to documentation
Projects
None yet
Development

No branches or pull requests

3 participants