3

The nginx.conf is simple:

sudo cat /usr/local/nginx/conf/nginx.conf    
worker_processes  1; 
error_log logs/error.log error;
events {
    worker_connections  4096;
}

rtmp { 
    server { 
        listen 1935; 
        application live { 
            live on; 
            dash on; 
            dash_path /mnt/dash; 
            dash_fragment 15s; 
        } 
    } 
} 
 
http { 
    server { 
        listen 80; 
        location /dash { 
            root /mnt; 
        } 
    }
 
    types {
        text/html html;
        application/dash+xml mpd;
    } 
}

I push the web camera to 127.0.0.1.

output="rtmp://127.0.0.1:1935/live/sample"
ffmpeg -f v4l2 -video_size 640x480 -i /dev/video0 -c:v libx264 -f flv $output

Pull it with rtmp protocol:

ffplay  rtmp://127.0.0.1:1935/live/sample

Succeeded!

Pull it with dash protocol:

ffplay  http://127.0.0.1/dash/sample.mpd

It encounter an error:

http://127.0.0.1/dash/sample.mpd: Invalid data found when processing input

How to fix it?
My os :debian9.

ffplay -formats |& grep "DASH Muxer"
  E dash            DASH Muxer
scrapy
  • 323
  • 4
  • 12
  • 27

1 Answers1

2

You need to recompile ffplay with DASH Demuxing enabled. It's possible that a pre-made package with DASH Demuxing enabled is already provided for your operating system but since it's not absolutely certain and you didn't specify what OS you're using I'm going to describe how to build ffplay with DASH Demuxing enabled manually.

Clone ffmpeg repository:

git clone --depth 1 https://git.ffmpeg.org/ffmpeg.git ffmpeg

Change to ffmpeg directory:

cd ffmpeg

Run ./configure script with needed parameters:

./configure --prefix=$HOME/ffmpeg-install --enable-demuxer=dash --enable-libxml2

Build and install ffplay to $HOME/ffmpeg-install:

make -j$(nproc) install

It took only 4 minutes on my machine. Make sure that the newly built ffmpeg comes with DASH Demuxing support:

$ ~/ffmpeg-install/bin/ffplay -formats |& grep "DASH Muxer"
 DE dash            DASH Muxer

Use it instead of the stock ffplay:

~/ffmpeg-install/bin/ffplay http://127.0.0.1/dash/sample.mpd

References: this answer

Arkadiusz Drabczyk
  • 25,049
  • 5
  • 53
  • 68