audiogstreamerrtpopus

Write, then read rtpopus to file with gstreamer?


Is it possible to write rtpopus to a file, then read it back with gstreamer? It seems simple but I'm getting nowhere with it and can't seem to find any information online. Here is my attempt:

gst-launch-1.0.exe audiotestsrc ! opusenc ! rtpopuspay ! filesink location=test.opus

Then, close and run:

gst-launch-1.0.exe filesrc location="test.opus" ! rtpopusdepay ! fakesink dump=true

gstreamer fails with:

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/GstFileSrc:filesrc0: Internal data stream error.
Additional debug info:
../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstFileSrc:filesrc0:
streaming stopped, reason error (-5)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

Solution

  • I don't think it could work. RTP is related to UDP packetization so it would work when streaming over UDP.

    You'd better use a file container supporting opus audio such as matroskamux:

    gst-launch-1.0 -e audiotestsrc ! audioconvert ! opusenc ! matroskamux ! filesink location=test.mkv
    
    # Let play for 5s and stop with Ctrl-C
    
    # Replay:
    gst-launch-1.0 filesrc location=test.mkv ! matroskademux ! opusdec ! audioconvert ! autoaudiosink