shuckle
Posts: 565
Joined: Sun Aug 26, 2012 11:49 am
Location: Finland

vlc h264 streaming not working with Jessie

Tue Mar 29, 2016 11:40 am

Before I start digging this more than what I have now done....
This works great in Wheezy and I can see the stream (rtsp://192.168.254.13:8888/h264) with VLC in another machine:

Code: Select all

$ v4l2-ctl --set-fmt-video=width=1296,height=1080,pixelformat=4
$ v4l2-ctl --set-ctrl video_bitrate=4000000
$ v4l2-ctl -p 5

$ cvlc -v v4l2:///dev/video0:chroma="H264":width=1296:height=976:f=5 --sout="#rtp{sdp=rtsp://:8888/h264}"
versions:
vcgencmd version
Nov 18 2015 15:48:41
Copyright (c) 2012 Broadcom
version 0c9af7cde38e223c95c3404f468db8fc5004495c (clean) (release)

uname -a
Linux raspberry7 4.1.13+ #826 PREEMPT Fri Nov 13 20:13:22 GMT 2015 armv6l GNU/Linux

vlc --version
VLC media player 2.0.3 Twoflower (revision 2.0.2-93-g77aa89e)
VLC, versio 2.0.3 Twoflower (2.0.2-93-g77aa89e)


But in Jessie vlc gives endless list of warnings:
[73b0aac0] packetizer_h264 decoder warning: waiting for SPS/PPS
and the remove vlc can not open the stream.

I wonder if the difference is due to vlc or firmware changes?
Anybody streaming h264 from raspberry camera with vlc in Jessie?

corpusm
Posts: 1
Joined: Sun May 22, 2016 7:43 pm

Re: vlc h264 streaming not working with Jessie

Sun May 22, 2016 7:59 pm

Probably replying to this a bit late but I have been having exactly the same problems. Currently using a Raspberry PI 3 and Jessie and exactly the same command lines that work on the Raspberry Pi 2 using Wheezy will not work under Jessie. Seems to be specifically a problem with the V4L2 drivers and VLC. FFMPEG works fine with the V4L2 drivers so I don't think the drives themselves are the issue.

For what it's worth the "raspivid" command now works way better than it used to and you can get satisfactory (as good) results using something like:

Code: Select all

raspivid -o - -t 0 -hf -w 1280 -h 720 -b 1000000 -fps 25|cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8554}' :demux=h264
In my case I need to merge this with an audio stream and vlc is not happy with merging my usb microphone audio with the output from raspivid (whereas this worked fine on the Raspberry Pi 2). So this:

Code: Select all

$raspivid -o - -t 0 -hf -w 1280 -h 720 -b 1000000 -fps 25|cvlc -vvv stream:///dev/stdin --input-slave=alsa://plughw:1,0 --sout='#transcode{vcodec=none,acodec=mp3,ab=128,samplerate=22050}:rtp{sdp=rtsp://:8554/}' :sout-keep :demux=h264
Just gives
[74702c40] core input warning: clock gap, unexpected stream discontinuity
[74702c40] core input warning: feeding synchro with a new reference point trying to recover from clock gap
But if you just need the video stream then the above may work for you.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7304
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: vlc h264 streaming not working with Jessie

Tue May 24, 2016 12:03 pm

There aren't any significant firmware or kernel changes I can think of.
If you have a sacrificial SD card you don't mind reimaging, then:
- clone your existing Wheezy card
- boot with it
- "sudo rpi-update" to get the latest kernel and firmware
- try VLC again.
That will be testing with exactly the same kernel and firmware that Jessie is using. If it works, then VLC have updated something.

Your post implies you're using VLC 2.0.3 on Wheezy - could you confirm? It looks like 2.0.3, 2.2.1, and 2.2.3 are all available on Jessie, so you should be able to downgrade and test it out.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

shuckle
Posts: 565
Joined: Sun Aug 26, 2012 11:49 am
Location: Finland

Re: vlc h264 streaming not working with Jessie

Tue May 24, 2016 12:18 pm

Yes, I am using

Code: Select all

$ LANG=C vlc --version
VLC media player 2.0.3 Twoflower (revision 2.0.2-93-g77aa89e)
VLC version 2.0.3 Twoflower (2.0.2-93-g77aa89e)
Compiled by buildd on build04.raspbian.lan (Feb  2 2015 15:45:40)
Compiler: gcc version 4.6.3 (Debian 4.6.3-14+rpi1) 
This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute it under the terms of the GNU General Public License;
see the file named COPYING for details.
Written by the VideoLAN team; see the AUTHORS file.
Will try the rpi-update (takes some time to build it)

shuckle
Posts: 565
Joined: Sun Aug 26, 2012 11:49 am
Location: Finland

Re: vlc h264 streaming not working with Jessie

Tue May 24, 2016 12:20 pm

thanks corpusm, but your example did not work for me.
I can get raspivid method to work but it is as unreliable than by running directly from v4l2

shuckle
Posts: 565
Joined: Sun Aug 26, 2012 11:49 am
Location: Finland

Re: vlc h264 streaming not working with Jessie

Tue May 24, 2016 6:30 pm

I tested the rpi-update from wheezy. And streaming works! And I did not even add :demux=h264.
So it is vlc that has changed something which breaks the streaming.

So how do I downgrade vlc in Jessie?
Or is there any other program, which can stream h264 from v4l2?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7304
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: vlc h264 streaming not working with Jessie

Tue May 24, 2016 8:21 pm

shuckle wrote:I tested the rpi-update from wheezy. And streaming works! And I did not even add :demux=h264.
So it is vlc that has changed something which breaks the streaming.

So how do I downgrade vlc in Jessie?
Or is there any other program, which can stream h264 from v4l2?
Sorry, I was wrong that Jessie had both versions - reading the repo details is new to me.
http://mirrordirector.raspbian.org/rasp ... ain/v/vlc/ lists vlc_2.0.3-5+deb7u2_armhf.deb and vlc_2.2.1-1~deb8u1_armhf.deb. I'm just working out that deb7 is going to be Wheezy, and deb8 is Jessie. So Jessie only sees 2.2.1.
Whether it's the official way, I've added

Code: Select all

deb http://mirrordirector.raspbian.org/raspbian/ wheezy main
to /etc/apt/sources.list.

Code: Select all

sudo apt-get update
sudo apt-get install -t wheezy vlc
Seems to have installed something.

Code: Select all

pi@raspberrypi:~ $ vlc -v
VLC media player 2.0.3 Twoflower (revision 2.0.2-93-g77aa89e)
GStreamer is probably your other option for streaming video, although there are issues found there at the moment - https://github.com/raspberrypi/linux/issues/849
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Luke_Nuke
Posts: 1
Joined: Thu Sep 08, 2016 11:49 pm

Re: vlc h264 streaming not working with Jessie

Thu Sep 08, 2016 11:51 pm

I'm in the same boat. It is really a shame. Are there any other good options for streaming h264 other than vlc and gstreamer, worth looking at?

Return to “Graphics, sound and multimedia”