webm – opus

trying to get rid of the opus garbled sound when sending from the v4l2 capture card

started here:
ffmpeg \
-f alsa -thread_queue_size 2048 -channels 2 -channel_layout stereo -i default:CARD=DVC100 \
-c:a libopus -ac 2 -b:a 48k \
-vn -f rtp rtp://10.11.1.96:5118
ffmpeg \
-f alsa -thread_queue_size 2048 -channels 2 -channel_layout stereo -i default:CARD=DVC100 \
-c:a libopus -ac 2 -b:a 48k -vbr off -compression_level 5 \
-vn -f rtp rtp://10.11.1.96:5122
and a gazillion permutations of that

ffmpeg -h encoder=libopus
Encoder libopus [libopus Opus]:
General capabilities: delay small
Threading capabilities: none
Supported sample rates: 48000 24000 16000 12000 8000
Supported sample formats: s16 flt
libopus AVOptions:
-application E…A… Intended application type (from 2048 to 2051) (default audio)
voip E…A… Favor improved speech intelligibility
audio E…A… Favor faithfulness to the input
lowdelay E…A… Restrict to only the lowest delay modes
-frame_duration E…A… Duration of a frame in milliseconds (from 2.5 to 60) (default 20)
-packet_loss E…A… Expected packet loss percentage (from 0 to 100) (default 0)
-vbr E…A… Variable bit rate mode (from 0 to 2) (default on)
off E…A… Use constant bit rate
on E…A… Use variable bit rate
constrained E…A… Use constrained VBR
-mapping_family E…A… Channel Mapping Family (from -1 to 255) (default -1)

Lorenzo told me to try this, but how does it work?
opusrtp – encapsulate Opus audio in RTP
Docs are very light.

our actual goal will be to record a high quality file for making a dvd. Perhaps we can do that and send it as it is being created

starting with low quality:
ffmpeg -re -f alsa -thread_queue_size 2048 -channels 2 -channel_layout stereo -i default:CARD=DVC100 -c:a libopus -ac 2 -vn -f webm 2.webm

ffmpeg -f alsa -thread_queue_size 2048 -channels 2 -channel_layout stereo -i 2.webm -c:a libopus -ac 2 -b:a 48k -vbr off -compression_level 10 -vn -f rtp rtp://10.11.1.96:5118

ffmpeg -i 2.webm \
-vn -f rtp rtp://10.11.1.96:5118

ffmpeg -f alsa -i default:CARD=DVC100 -acodec libopus -ac 2 -b:a 48k -vbr on -compression_level 10 -y out.webm

also bad:
/usr/local/bin/gst-launch-1.0 videotestsrc ! jpegenc ! rtpjpegpay ! udpsink host=10.11.1.96 port=5122

/usr/local/bin/gst-launch-1.0 videotestsrc ! jpegenc ! rtpjpegpay ! udpsink host=10.11.1.96 port=5122

https://github.com/GStreamer/gst-plugins-good/blob/master/tests/examples/rtp/client-VP8-OPUS.sh
[swarm mydetv channel 0]
type = rtp
id = 11
description = swarm mydetv channel 0 remote
audio = yes
video = yes
audioport = 5018
audiopt = 111
audiortpmap = opus/48000/2
videoport = 5020
videopt = 100
videortpmap = vp8/90000

#!/bin/sh
#
# A simple RTP receiver
#

VIDEO_CAPS=”application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)VP8″
AUDIO_CAPS=”application/x-rtp,media=(string)audio,clock-rate=(int)48000,encoding-name=(string)OPUS”

SRC=localhost
DEST=localhost

VIDEO_DEC=”rtpvp8depay ! vp8dec”
AUDIO_DEC=”rtpopusdepay ! opusdec”

VIDEO_SINK=”videoconvert ! autovideosink”
AUDIO_SINK=”audioconvert ! audioresample ! autoaudiosink”

LATENCY=100

gst-launch-1.0 -v rtpbin name=rtpbin latency=$LATENCY \
udpsrc caps=$VIDEO_CAPS address=$SRC port=5000 ! rtpbin.recv_rtp_sink_0 \
rtpbin. ! $VIDEO_DEC ! $VIDEO_SINK \
udpsrc address=$SRC port=5001 ! rtpbin.recv_rtcp_sink_0 \
rtpbin.send_rtcp_src_0 ! udpsink host=$DEST port=5005 sync=false async=false \
udpsrc caps=$AUDIO_CAPS address=$SRC port=5002 ! rtpbin.recv_rtp_sink_1 \
rtpbin. ! $AUDIO_DEC ! $AUDIO_SINK \
udpsrc address=$SRC port=5003 ! rtpbin.recv_rtcp_sink_1 \
rtpbin.send_rtcp_src_1 ! udpsink host=$DEST port=5007 sync=false async=false

WHAT DOES THAT MEAN? and how do we make it work for our dvc?

gst-launch-1.0 -v rtpbin name=rtpbin latency=$LATENCY \
udpsrc caps=$VIDEO_CAPS address=$SRC port=5000 \
! rtpbin.recv_rtp_sink_0 rtpbin. \
! $VIDEO_DEC \
! $VIDEO_SINK udpsrc address=$SRC port=5001 \
! rtpbin.recv_rtcp_sink_0 rtpbin.send_rtcp_src_0 \
! udpsink host=$DEST port=5005 sync=false async=false udpsrc caps=$AUDIO_CAPS address=$SRC port=5002 \
! rtpbin.recv_rtp_sink_1 rtpbin. \
! $AUDIO_DEC \
! $AUDIO_SINK udpsrc address=$SRC port=5003 \
! rtpbin.recv_rtcp_sink_1 rtpbin.send_rtcp_src_1 \
! udpsink host=$DEST port=5007 sync=false async=false

Oh yeah, there is also this completely undocumented script:
#!/bin/sh
#
# A simple RTP server
#

SRC=localhost
DEST=localhost
VCAPS=”video/x-raw,width=352,height=288,framerate=15/1″

gst-launch-1.0 -v rtpbin name=rtpbin \
videotestsrc ! $VCAPS ! vp8enc ! rtpvp8pay ! rtpbin.send_rtp_sink_0 \
rtpbin.send_rtp_src_0 ! udpsink host=$DEST port=5000 \
rtpbin.send_rtcp_src_0 ! udpsink host=$DEST port=5001 sync=false async=false \
udpsrc address=$SRC port=5005 ! rtpbin.recv_rtcp_sink_0 \
audiotestsrc ! opusenc ! rtpopuspay ! rtpbin.send_rtp_sink_1 \
rtpbin.send_rtp_src_1 ! udpsink host=$DEST port=5002 \
rtpbin.send_rtcp_src_1 ! udpsink host=$DEST port=5003 sync=false async=false \
udpsrc address=$SRC port=5007 ! rtpbin.recv_rtcp_sink_1

and we keep googling
gst-launch-1.0 audiotestsrc ! audioconvert ! audioresample !opusenc ! rtpopuspay !udpsink host=reciver port=5122

Leave a Reply

Your email address will not be published. Required fields are marked *