Anakooter
Anakooter

Reputation: 327

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?

Upvotes: 3

Views: 7466

Answers (2)

Rolf of Saxony
Rolf of Saxony

Reputation: 22443

Don't shoot me down in flames, as I do not use VLC for this type of thing but I recall that to get Gstreamer working with H265, I had to install:
libde265 and gstreamer1.0-libde265
There is also a vlc-plugin-libde265 listed in the ubuntu repositories.
See: https://github.com/strukturag/libde265

Upvotes: 1

mpromonet
mpromonet

Reputation: 11942

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)

Upvotes: 3

Related Questions