Logitech C920, streaming H.264

Aus Wiki
Wechseln zu: Navigation, Suche


hardware encoded video streaming

  • set camera pixelformat to H264
v4l2-ctl --device=/dev/video1 --set-fmt-video=width=800,height=600,pixelformat=1
  • test H264 playback with vlc, this way it won't reset the settings:
cvlc v4l2:///dev/video1 --demux h264
  • if you try it like this, vlc will reset the settings before playback:
cvlc v4l2:///dev/video1:chroma=h264
  • playback works. we get a H264 stream from the cam. now let's stream it over the network via HTTP:
cvlc v4l2:///dev/video1:chroma=h264:width=800:height=600 --sout '#standard{access=http,mux=ts,dst=localhost:8080,name=stream,mime=video/ts}' -vvv
  • (on the network you need to use your LAN device's IP instead of localhost)
  • play:
mplayer http://localhost:8080/
  • turns out, MPEG-TS enables mplayer to hook into the stream at any time with a slight delay (probably waiting for a keyframe or sth like that)
  • if you use mux=avi,mime=video/avi instead, you need to start mplayer in the very moment you start vlc, else mplayer will not start playing

fmpeg bug

  • if you try ffmpeg instead of vlc for playback, you will probably encounter this problem: https://ffmpeg.org/trac/ffmpeg/ticket/1387
  • as soon as you start ffmpeg, it will switch back to "Video: rawvideo (YUY2 / 0x32595559)"
  • while it accepts MJPEG, it won't work with H.264
  • same apparently happens when using qv4l2: Start capturing in H264 mode actually gives you a YUY2 video window

hardware decoded video playback

  • mplayer is capable of playback on the framebuffer, make sure X is not running and type:
mplayer -fs -framedrop -vo fbdev
  • you can also play in an X window, if you prefer: start X from command line:
Xorg -retro &> /dev/zero
  • there are loads of fbdev error messages coming up, which we silently discard into /dev/zero
  • play video stream from LAN vlc source (see section above):
DISPLAY=":0" mplayer -fs -framedrop

Raspberry Pi

In case you experience ugly, choppy artifacts in the picture, while streaming from a Raspberry Pi using

cvlc v4l2:///dev/video0:chroma=h264 ...

you might need to upgrade your firmware:

apt-get install rpi-update raspi-config

Solved the problem for me.



Meine Werkzeuge