Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VLC: Unable to open SDP file for H265 using FFMPEG

I am streaming live video using rtp and ffmpeg using this command:

ffmpeg -re -f v4l2 -framerate 30 -video_size 640x480 -i /dev/video0 -c:v libx265 -tune zerolatency -s 320x240 -preset ultrafast -pix_fmt yuv420p -r 10 -strict experimental -f rtp rtp://127.0.0.1:49170 > ffmpeg.sdp

The generated sdp file is:

v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 127.0.0.1
t=0 0
a=tool:libavformat 56.36.100
m=video 49170 RTP/AVP 96
a=rtpmap:96 H265/9000

Vlc gives the following error:

The format of 'file:///home/username/ffmpeg.sdp' cannot be detected. Have a look at the log for details.

Terminal gives the following error:

[0xaf801010] ps demux error: cannot peek
[0xaf801010] mjpeg demux error: cannot peek
[0xaf801010] mpgv demux error: cannot peek
[0xaf801010] ps demux error: cannot peek
[0xb6d00618] main input error: no suitable demux module for `file/:///home/username/ffmpeg.sdp'

If I simply change libx265 -> libx264 in the command and H265 -> H264 the stream runs perfectly fine.

However I need to stream on H265. Any Suggestions?

like image 266
Anakooter Avatar asked Sep 01 '25 16:09

Anakooter


1 Answers

I guess the problem is because VLC (or ffplay) doesn't get the VPS,SPS,PPS frames. In order to start to decode H265 stream you need a VPS, a SPS, a PPS and an IDR frame.

In order to ask to libx265 to repeat these configuration frames before each IDR frame you could add to your streaming command :

-x265-params keyint=30:repeat-headers=1

Then the command becomes :

ffmpeg -re -f v4l2 -framerate 30 -video_size 640x480 -i /dev/video0 -c:v libx265 -tune zerolatency -x265-params keyint=30:repeat-headers=1 -s 320x240 -preset ultrafast -pix_fmt yuv420p -r 10 -strict experimental -f rtp rtp://127.0.0.1:49170 > ffmpeg.sdp

It generate the following ffmpeg.sdp file:

SDP: 
v=0 
o=- 0 0 IN IP4 127.0.0.1 
s=No Name c=IN IP4 127.0.0.1 
t=0 0 
a=tool:libavformat 56.36.100 
m=video 49170 RTP/AVP 96 
a=rtpmap:96 H265/90000

I was able to display the stream with ffplay ffmpeg.sdp and VLC ffmpeg.sdp (removing the first line SDP: of ffmpeg.sdp)

like image 148
mpromonet Avatar answered Sep 06 '25 09:09

mpromonet