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

obs-outputs: Enable eRTMP Flac and Opus support #11462

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yuriy-chumak
Copy link
Contributor

Description

This PR enables Flac and Opus audio codecs for the eRTMP protocol according the spec.

Note: the eRTMP backend may not accept both codecs.

Motivation and Context

Add more audio codecs to the stream.

How Has This Been Tested?

It has been tested using:

  1. OBS Studio as RTMP sender (Linux, Windows, macOS),
  2. modified FFmpeg instance as eRTMP server (Linux only),
  3. modified FFplay instance as RTMP client (Linux only).

The provided FFMpeg patch makes the modified ffmpeg server accept flac and opus audio codecs inside the eRTMP stream.

Types of changes

  • Tweak (non-breaking change to improve existing functionality)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

Testing

The PR can be tested using a modified FFmpeg library. Modified FFmpeg accept flac and opus audio codecs inside the eRTMP stream.

The following steps are a working example of the testing pipeline.

Preparation

Configure and Run Backend (Linux)

  • Note empty rtmp port for a backend instance. Let it be 8889.
  • Create next shell script to run the backend (change the ${port-number} to the port number, change the ${the_folder_with_ffmpeg} to the real modified FFmpeg path).
    #!/bin/sh
    export LD_LIBRARY_PATH=${the_folder_with_ffmpeg}
    export PATH=${the_folder_with_ffmpeg}:$PATH
    
    while true; do
    echo =============================== `date` ============================
    ffmpeg -f flv -listen 1 \
       -v trace -hide_banner \
       -i rtmp://localhost:${port-number}/live/app \
       -c:v copy -c:a copy \
       -f flv - \
    |  ffplay - -autoexit
    
       sleep 1
    done
  • Run backends by running rtmp-server.sh.

Configure and Run OBS Studio (any OS)

  • Run OBS Studio and change the next "Stream" settings:
    • Service: Custom...
    • Server: rtmp://localhost:8889/live (the port value must be a port of a backend)
    • Stream Key: "app"
      2024-02-15-21-17-49
  • Change the next "Output" settings:
    • Select "Audio Encoder" to the "FLAC" or "Opus" with "Output Mode" set to "Advanced".
  • Start OBS-Studio Streaming.
    We must see the running logs in the backend console, and a proper status notifications in the OBS-Studio.
    2024-02-15-21-19-48
    We must hear the proper audio with automatically runned FFplay.

@WizardCM WizardCM added the Enhancement Improvement to existing functionality label Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Improvement to existing functionality
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants