[vlc] Streaming set up for HD-PVR device ?

linux guy linuxguy123 at gmail.com
Tue Oct 29 20:58:53 CET 2013


I'm setting up a whole house AV system. Our house has 2 satellite receivers.

I'd like to connect an HD-PVR to each receiver and stream the outputs so
that they can be watched anywhere in the house on a variety of devices via
our local network.

I'm running Fedora 19 these days.
$ uname -a
Linux XPS17.localdomain 3.11.6-200.fc19.x86_64 #1 SMP Fri Oct 18 22:34:18
UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Progress thus far.

The HD-PVR device is recognized by the OS and the driver is installed
automatically.

I get this in dmesg

usb 2-1.2: new high-speed USB device number 10 using ehci-pci
[25096.604008] usb 2-1.2: New USB device found, idVendor=2040,
idProduct=4903
[25096.604013] usb 2-1.2: New USB device strings: Mfr=1, Product=2,
SerialNumber=3
[25096.604015] usb 2-1.2: Product: Hauppauge HD PVR
[25096.604017] usb 2-1.2: Manufacturer: AMBA
[25096.604018] usb 2-1.2: SerialNumber: 00A5EB14
[25096.622360] hdpvr 2-1.2:1.0: firmware version 0x1e dated Mar 7 2012
08:25:15
[25097.143552] hdpvr 2-1.2:1.0: device now attached to video1

lsmod shows the driver is installed.

$ lsmod | grep hdpvr
hdpvr 32518 0
v4l2_common 15138 1 hdpvr
videodev 132348 4 hdpvr,uvcvideo,v4l2_common,videobuf2_core
i2c_core 34242 5 i2c_i801,hdpvr,nvidia,v4l2_common,videodev


For testing, I started out with this, which creates a file from the HD-PVR
output.

cat /dev/video1 > stream.ts


vlc test.ts plays the file correctly and returns the following.

$ vlc stream.ts
VLC media player 2.0.8 Twoflower (revision 2.0.7-29-g12aebf9)
[0x1564108] main libvlc: Running vlc with the default interface. Use 'cvlc'
to use vlc without interface.
[0x7f2b78001b78] ts demux error: MPEG-4 descriptor not found
[0x7f2b78cb1dc8] packetizer_mpeg4audio packetizer: AAC channels: 2
samplerate: 48000
Fontconfig warning: FcPattern object size does not accept value "0"
Fontconfig warning: FcPattern object size does not accept value "0"
[h264 @ 0x7f2b78caaaa0] illegal short term buffer state detected
^C

mplayer test.ts plays the file correctly and returns the following.

$ mplayer stream.ts
MPlayer SVN-r36171-4.8.1 (C) 2000-2013 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote
control.

Playing stream.ts.
libavformat version 54.63.104 (external)
TS file format detected.
VIDEO H264(pid=4113) AUDIO AAC(pid=4352) NO SUBS (yet)! PROGRAM N. 1
FPS seems to be: 30.000000
Load subtitles in ./
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 54.92.100 (external)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, floatle, 0.0 kbit/0.00% (ratio: 0->384000)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
AO: [pulse] 48000Hz 2ch floatle (4 bytes per sample)
Starting playback...
Movie-Aspect is undefined - no prescaling applied.
VO: [vdpau] 1920x1088 => 1920x1088 Planar YV12
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [vdpau] 1920x1080 => 1920x1080 Planar YV12
Dropping frame with size not matching configured size
A: 5.3 V: 5.4 A-V: -0.115 ct: -0.166 297/297 25% 7% 0.2% 10 0
Exiting... (End of file)


Mplayer will play the live stream correctly after a bit of complaining.

$ mplayer /dev/video1
MPlayer SVN-r36171-4.8.1 (C) 2000-2013 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote
control.

Playing /dev/video1.
libavformat version 54.63.104 (external)
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
TS file format detected.
Cannot seek backward in linear streams!
Seek failed
VIDEO H264(pid=4113) AUDIO AAC(pid=4352) NO SUBS (yet)! PROGRAM N. 1
Cannot seek backward in linear streams!
Seek failed
FPS seems to be: 30.000000
Load subtitles in /dev/
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 54.92.100 (external)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, floatle, 0.0 kbit/0.00% (ratio: 0->384000)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
AO: [pulse] 48000Hz 2ch floatle (4 bytes per sample)
Starting playback...
Movie-Aspect is undefined - no prescaling applied.
VO: [vdpau] 1920x1088 => 1920x1088 Planar YV12
[h264 @ 0x7fc1ba47d5c0]mmco: unref short failure
[h264 @ 0x7fc1ba47d5c0]mmco: unref short failure
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [vdpau] 1920x1080 => 1920x1080 Planar YV12
Dropping frame with size not matching configured size
[h264 @ 0x7fc1ba47d5c0]mmco: unref short failure
[h264 @ 0x7fc1ba47d5c0]mmco: unref short failure
A: 17.1 V: 17.1 A-V: 0.010 ct: -0.526 430/430 24% 8% 5.4% 14 0

Exiting... (Quit)

VLC will NOT play the live stream directly, at least from the command line
using the simple device.

$ vlc /dev/video1
VLC media player 2.0.8 Twoflower (revision 2.0.7-29-g12aebf9)
[0x1dca108] main libvlc: Running vlc with the default interface. Use 'cvlc'
to use vlc without interface.
libdvbpsi error (PSI decoder): TS discontinuity (received 2, expected 0)
for PID 0
libdvbpsi error (PSI decoder): TS discontinuity (received 2, expected 0)
for PID 256

However, I can get vlc to play the live stream by setting the HDPVR device
up as a PVR capture device in the gui.

vlc-> media-> capture device
set Capture Mode to PVR
set device name to /dev/video1
press Play

The command line output while I do this is:

$ vlc
VLC media player 2.0.8 Twoflower (revision 2.0.7-29-g12aebf9)
[0x917108] main libvlc: Running vlc with the default interface. Use 'cvlc'
to use vlc without interface.
[0x7f9a880020d8] ts demux error: MPEG-4 descriptor not found
[0x7f9a88e6fa08] packetizer_mpeg4audio packetizer: AAC channels: 2
samplerate: 48000
Fontconfig warning: FcPattern object size does not accept value "0"
Fontconfig warning: FcPattern object size does not accept value "0"
[h264 @ 0x7f9a88d3df80] illegal short term buffer state detected

So basically I can create and view files from the HD-PVR and I can view the
live output with mplayer and vlc.

What I really want to do is stream the output so that I can watch it on
devices anywhere in the house, ie devices not directly connected to the
HDPVRs.

*Theoretically* one can do that by selecting Stream rather than Play in the
vlc GUI.

vlc-> Media -> Open Capture Device
Capture Mode = PVR
Device Name = /dev/video1

At this point my "Edit Options" are :pvr-device=/dev/video1
:pvr-radio-device=HDPVR :pvr-norm=0 :live-caching=300

I then select Stream instead of Play.

In Destination Setup, I add an HTTP destination and set the path to /stream.

As far as Transcoding, here is where things get interesting. I'm not sure I
want to transcode anything. I've already demonstrated that both vlc and
mplayer will play the stream directly from the HD-PVR itself. Why do I need
to transcode it ?

Nevertheless, I chose Active Transcoding with a Video- H.264+MP3 profile.

At the end of all this, my "Generated stream output string" is
:sout=#transcode{vcodec=h264,vb=0,scale=0,acodec=mpga,ab=128,channels=2,samplerate=44100}:http{mux=avi,dst=:8080/stream}
:sout-keep

I check that its actually running.

$ netstat -nap | grep 8080
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 18496/vlc
tcp6 0 0 :::8080 :::* LISTEN 18496/vlc

During all this the command line displays the following.
$ vlc
VLC media player 2.0.8 Twoflower (revision 2.0.7-29-g12aebf9)
[0x126f108] main libvlc: Running vlc with the default interface. Use 'cvlc'
to use vlc without interface.
libdvbpsi error (PSI decoder): TS discontinuity (received 2, expected 0)
for PID 0
libdvbpsi error (PSI decoder): TS discontinuity (received 2, expected 0)
for PID 256
[0x7fc304002c58] ts demux error: MPEG-4 descriptor not found
[0x7fc30517ffc8] packetizer_mpeg4audio decoder: AAC channels: 2 samplerate:
48000


If I fire up another instance of VLC (via the gui) and use it to view the
stream, it displays a black screen and I get this.

$ vlc
VLC media player 2.0.8 Twoflower (revision 2.0.7-29-g12aebf9)
[0x1598108] main libvlc: Running vlc with the default interface. Use 'cvlc'
to use vlc without interface.
libdvbpsi error (PSI decoder): TS discontinuity (received 10, expected 0)
for PID 0
libdvbpsi error (PSI decoder): TS discontinuity (received 10, expected 0)
for PID 66
[0x7ff9100024b8] ts demux error: MPEG-4 descriptor not found
[0x7ff910cbdc88] packetizer_mpeg4audio packetizer: AAC channels: 2
samplerate: 48000
Fontconfig warning: FcPattern object size does not accept value "0"
Fontconfig warning: FcPattern object size does not accept value "0"
[h264 @ 0x7ff910d4e7a0] mmco: unref short failure
x 100 times...

Netstat shows this
$ netstat -nap | grep 8080
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 18496/vlc
tcp 0 0 127.0.0.1:8080 127.0.0.1:53735 TIME_WAIT -
tcp6 0 0 :::8080 :::* LISTEN 18496/vlc


When I run VLC from the command line, I get a different error.
vlc http://127.0.0.1:8080/stream
VLC media player 2.0.8 Twoflower (revision 2.0.7-29-g12aebf9)
[0x25a3108] main libvlc: Running vlc with the default interface. Use 'cvlc'
to use vlc without interface.
[0x7ffc4c006558] main stream error: cannot pre fill buffer

When run mplayer from the command line, I get this

$ mplayer http://127.0.0.1:8080/stream
MPlayer SVN-r36171-4.8.1 (C) 2000-2013 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote
control.

Playing http://127.0.0.1:8080/stream.
Resolving 127.0.0.1 for AF_INET6...
Connecting to server 127.0.0.1[7f00:1::]: 8080...

Failed to connect to server with AF_INET6
Connecting to server 127.0.0.1[127.0.0.1]: 8080...

Cache size set to 320 KBytes
Cache fill: 0.00% (0 bytes) nop_streaming_read error : Resource temporarily
unavailable
Stream not seekable!
Cache fill: 0.00% (0 bytes) Stream not seekable!
Cache fill: 0.00% (0 bytes) Stream not seekable!
Cache fill: 0.00% (0 bytes) Stream not seekable!
Cache fill: 0.00% (0 bytes) Stream not seekable!
Cache fill: 0.00% (0 bytes)

libavformat version 54.63.104 (external)

Exiting... (End of file)

And that is as far as I have gotten.

I forgot to mention that I am not able to connect to the HC-PVR using teh
Video for Linux mode.

vlc-> Media -> Open Capture Device
Capture Mode = Video for Linux 2
Video Device name = /dev/video1
Press Play.

Result is "VLC is unable to open the MRL 'v4l2:///dev/video1"

The command line shows the following.
$ vlc
VLC media player 2.0.8 Twoflower (revision 2.0.7-29-g12aebf9)
[0x1407108] main libvlc: Running vlc with the default interface. Use 'cvlc'
to use vlc without interface.
[0x7f4a2c0010c8] v4l2 demux error: Could not match pixel format
[0x7f4a2c004b78] v4l2 access error: Could not match pixel format
[0x7f4a2c004b78] v4l2 access error: Could not match pixel format
[0x7f4a44000b78] main input error: open of `v4l2:///dev/video1' failed

At this point I am stuck and unsure how to proceed.

I am able to view the live output of the HDPVR device in mplayer and vlc.

It would seem as though VLC is streaming the output of the HDPVR device,
but I am unable to view it.

Should I continue to struggle with trying to use VLC as my streamer ? Does
anyone see why it isn't working ?

Should I try rygel or gstreamer or ffserver ?

One thing that keeps me from trying ffserver is that it seems to want to
user to specify the stream format (codec, height and width) when it is
invoked. My satellite receiver changes screen resolution as program content
changes. SD programming, low quality commercials and the guide are output
in 720i. HD is output in 1080i. It changes output formats whenever it needs
to, depending on the input programming.

I know about and have played with MythTV and XBMC. I am setting my system
up primarily for live TV viewing. I think what I am doing will work (much)
better for live viewing than MythTV and XBMC presently do.

Any and all insight and advice to getting this working will be greatly
appreciated.

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc/attachments/20131029/1130603c/attachment.html>


More information about the vlc mailing list