snapcrafters / obs-studio

This is a community-supported modified build of OBS Studio.
https://snapcraft.io/obs-studio
111 stars 37 forks source link

Couldn't parse /etc/ssl/certs #120

Open bennlich opened 3 years ago

bennlich commented 3 years ago

Hey there. I'm on obs-studio 26.1.2-35-gbb6b1e53f.

I'm all of a sudden having trouble streaming to an rtmps endpoint I have used successfully in the past. From the logs:

info: mbedtls_x509_crt_parse_path: Couldn't parse /etc/ssl/certs
info: RTMP_TLS_LoadCerts: Failed to load root certificate chains, RTMPS connections will likely fail

and then

info: RTMP_Connect1, TLS_Connect failed: -0x7680

I found this related issue, but their solution did not work for me: https://obsproject.com/forum/threads/tls_connect-failed-0x7680.121880/#post-457008

I have plenty of certs in /etc/ssl/certs. They are all symlinks to .crt files in /usr/share/ca-certificates/mozilla/, e.g.:

-rw-r--r-- 1 root root 1.5K Jan 28 04:01  TrustCor_ECA-1.crt
-rw-r--r-- 1 root root 1.5K Jan 28 04:01  TrustCor_RootCert_CA-1.crt
-rw-r--r-- 1 root root 2.2K Jan 28 04:01  TrustCor_RootCert_CA-2.crt
slaff commented 3 years ago

info: mbedtls_x509_crt_parse_path: Couldn't parse /etc/ssl/certs

I am experiencing the same issue. Ubuntu version 16.04 LTS, Obs snap version: OBS Studio - 27.0.0-modified (linux). Is there a way to show more verbose information and see what exactly is mbedtls complaining about?

slaff commented 3 years ago

I am not sure how snaps work but it seems that reading files in /etc and such is not allowed by default. If that is the case adding system-files-interface to the https://github.com/snapcrafters/obs-studio/blob/master/snap/snapcraft.yaml#L90 file and building a new snap should fix the issue.

Enyer182 commented 3 years ago

I have this same issue, I have been following the thread, seems like there's a dependency missing for the RTMPS package.

flexiondotorg commented 2 years ago

If I shell into the OBS Studio with snap run --shell obs-studio I can see /etc/ssl/certs.

On Ubuntu classic systems with snapd 2.50 or newer, a new feature was added where /etc/ssl inside the mount namespace of a strict snap is bind-mounted from the host system, not from the base snap.

Can you confirm is this issue is still happening?

Please also include the snap --version in any feedback.

bennlich commented 2 years ago

@flexiondotorg yes, still seeing this issue.

snap --version
snap    2.52.1
snapd   2.52.1
series  16
debian  9.0
kernel  4.19.0-14-amd64

If I shell into the OBS Studio with snap run --shell obs-studio I can see /etc/ssl/certs.

Me too.

jidckii commented 2 years ago

This problem has been raised in many issues, but has not yet been resolved. What needs to be done to make it work? Right now I'm using a workaround. I am streaming to udp://localhost:1234 and then relaying to rtmps with ffmpeg, but that adds extra delay.

info: mbedtls_x509_crt_parse_path: Couldn't parse /etc/ssl/certs
info: RTMP_TLS_LoadCerts: Failed to load root certificate chains, RTMPS connections will likely fail
info: ---------------------------------
info: [FFMPEG VAAPI encoder: 'streaming_h264'] settings:
    device:       /dev/dri/by-path/pci-0000:00:02.0-render
    rate_control: CQP
    profile:      100
    level:        41
    qp:           23
    bitrate:      0
    maxrate:      0
    keyint:       120
    width:        1920
    height:       1020
    b-frames:     0

info: libfdk_aac encoder created
info: libfdk_aac bitrate: 160, channels: 2
info: [rtmp stream: 'adv_stream'] Connecting to RTMP URL rtmps://dc4-1.rtmp.t.me/s/...
info: RTMP_Connect1, TLS_Connect failed: -0x7680
info: [rtmp stream: 'adv_stream'] Connection to rtmps://dc4-1.rtmp.t.me/s/ failed: -2
info: ==== Streaming Stop ================================================

OS:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04 LTS
Release:    22.04
Codename:   jammy

snap:

$ snap --version
snap    2.56
snapd   2.56
series  16
ubuntu  22.04
kernel  5.15.0-37-generic

obs-studio latest from edge

$ sudo snap list | grep obs
obs-studio              27.2.1                      1287   latest/edge      snapcrafters   -
big-vl commented 1 month ago

ffmpeg -f flv -listen 1 -i rtmp://localhost:8889/live/app -c copy -f flv -flvflags no_duration_filesize rtmps://dc4-1.rtmp.t.me/s/

image

Start stream server to localhost, to send stream Telegram or Youtube.

big-vl commented 1 month ago

Example: image

i write bash for reconnect server, i find problem in ffmpeg...

#!/bin/bash

# Ваши аргументы для ffmpeg
FFMPEG_ARGS="-f flv -listen 1 -i rtmp://localhost:8889/live/app -c copy -f flv -flvflags no_duration_filesize -reconnect_at_eof 1 -reconnect_streamed 1 rtmps://dc4-1.rtmp.t.me/s/"

while true; do
    echo "Starting ffmpeg..."
    ffmpeg $FFMPEG_ARGS

    # Если ffmpeg завершился с ошибкой, вывести сообщение и подождать 5 секунд перед перезапуском
    if [ $? -ne 0 ]; then
        echo "ffmpeg crashed with exit code $?. Restarting in 5 seconds..."
        sleep 2
    else
        # Если ffmpeg завершился успешно, выйти из цикла
        echo "ffmpeg finished successfully."
        break
    fi
done

or service:


[Unit]
Description=FFmpeg Stream
After=network.target

[Service]
ExecStart=/usr/bin/ffmpeg -f flv -listen 1 -i rtmp://localhost:8889/live/app -c copy -f flv -flvflags no_duration_filesize -reconnect_at_eof 1 -reconnect_streamed 1 rtmps://dc4-1.rtmp.t.me/s/
Restart=always
RestartSec=2

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl start ffmpeg-stream
sudo systemctl enable ffmpeg-stream