1
votes

Is there a way to play an mpeg-dash audio stream from console? This is an example stream.

It would also be good to be able to force a specific stream quality.

I have tried mpv, cvlc but they don't seem to be able to parse the playlist and assemble the chunks.

2
Some useful info here - may save you some time of you have not seen it already. Choosing a specific stream seems to be a common issue: ronallo.com/blog/testing-dash-and-hls-streams-on-linuxMick
Take a look at this related question/answer using ffmpeg to playback DASH: stackoverflow.com/a/52853088/436794Pierz

2 Answers

2
votes

As mentioned in my comment one can now use ffmpeg's ffplay utility to playback DASH content from the command line. In earlier versions of ffmpeg DASH playback wasn't always enabled - see my related question for details e.g.:

ffplay  http://dash.edgesuite.net/dash264/TestCases/1a/netflix/exMPD_BIP_TC1.mpd

One can also use ffmpeg to process DASH media - so you can easily use it to download (or transform) DASH content e.g.:

ffmpeg -i http://dash.edgesuite.net/dash264/TestCases/1a/netflix/exMPD_BIP_TC1.mpd exMPD_BIP_TC1.mp4
0
votes

Update: VLC support for dash streaming

Latest versions of VLC are able to handle dash streams, so the terminal invocation would be:

cvlc https://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/dash/nonuk/dash_low/aks/bbc_world_service.mpd

Osmo4 (gpac)

osmo4 which is part of the gpac project can play dash MPD files, but unfortunately, it does not work in headless mode for audio-only streams.

dash.js

This is the official dash.js library which requires a browser. Whether it can be made to work under nodejs is not clear.

Here is a minimal implementation for playing an audio/video dash stream adapted from the dash.js readme.

<!doctype html>
<html>
<head>
    <title>Dash.js</title>
    <style>
        video {
            width: 640px;
            height: 360px;
        }
    </style>
</head>
<body>
<video id="videoPlayer" data-dashjs-player autoplay controls src="https://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/dash/nonuk/dash_low/aks/bbc_world_service.mpd">
</video>

<script src="//cdn.dashjs.org/latest/dash.all.min.js"></script>
</body>
</html>

Note: The file above will NOT work when opened from the local file system over a file:/// protocol. It requires a web server; any of the oneliners listed here would do.

Using Chrome/Chromium Headless

As of version 59 Google Chrome/Chromium can run in headless mode, which means it can be used on a headless system. Since there is no 'official' text-mode client for dash.js a somewhat heavyweight way to play dash audio in terminal would be opening it with headless chrome/chromium:

chromium-browser --headless --disable-gpu --repl https://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/dash/nonuk/dash_low/aks/bbc_world_service.mpd

Occasionally chrome/chromium would fail playing on first invocation, the --repl option seems to allow it to eventually start playing. The repl also lets you type arbitrary javascript like e.g. document.location.reload().