Can not play mpeg-dash created with nginx-ts-module
Hi,
I'm trying to stream media using the nginx-ts-module. Everything looks fine (the index.mpd and mp4 filed are created under /var/media/dash) also browsing to the index.mpd url works fine, but trying to play this dash using Dash JavaScript Player doesn't work.
I'm using nginx-1.13.9 with nginx-ts-module.
My nginx configuration is (/usr/local/nginx/conf/nginx.conf): `user root; worker_processes 1;
error_log logs/error.log info;
pid /var/run/nginx.pid;
events { worker_connections 1024; }
http { include mime.types; default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 8000;
location /publish/ {
# This directive sets unlimited request body size
client_max_body_size 0;
ts;
ts_hls path=/var/media/hls segment=10s;
ts_dash path=/var/media/dash segment=10s;
}
location /play/ {
types {
application/x-mpegURL m3u8;
application/dash+xml mpd;
video/MP2T ts;
video/mp4 mp4;
}
alias /var/media/;
}
}
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
} `
My ffmpeg command to stream media to nginx is:
ffmpeg -re -i "The LEGO Batman Movie - Trailer.mp4" -bsf:v h264_mp4toannexb -c copy -f mpegts http://{my_nginx_server_ip}:8000/publish/alilive
NOW. When I browse to http://{my_nginx_server_ip}:8000/play/dash/alilive/index.mpd I able to download the index.mpd. BUT, when I put this url in Dash JavaScript Player it is not playing the media.
On my nginx's error log I found a lots of this records: dropping unexpected TS packet pid:0x0011 But I read that I can ignore it here
One more thing,
I also trying to stream live web cam recording instead of The LEGO Batman Movie - Trailer.mp4 using ffmpeg with the following command:
ffmpeg -y -f dshow -i "video=Lenovo EasyCamera:audio=Microphone (High Definition Audio Device)" -bsf:v h264_mp4toannexb -c copy -f mpegts http://{my_nginx_server_ip}:8000/publish/alilive
But when I execute this command I get:
Codec 'mjpeg' (8) is not supported by the bitstream filter 'h264_mp4toannexb'
Why?
- What am I doing wrong?
- As all seems to be working well, why DASH-ID player can't play my media?
- How can I stream my video cam?
- Is there any error in browser js console when playing the dash stream? Try increasing the segment size.
- your webcam seems to send video in mjpeg codec rather than h264, you should transcode it to h264 with
-c:v libx264