1

I have a live H264 stream (hardware encoded from the webcam) and I'd like to stream it over the network using multicast on a Linux platform.

Because the platform has limited CPU power, and the data from the camera is already in H264 format, I don't want to transcode the stream - just broadcast it as-is, perhaps with additional wrapping in whatever transport container is needed.

I have tried this:

ffmpeg -f v4l2 -video_size hd720 -framerate 30 -input_format h264 -i /dev/video0 -vcodec copy -an -f rtp rtp://224.0.1.2:5001

Which does appear to multicast the data, but when I go to play the stream, I get a bunch of errors:

[h264 @ 0x7feffc064400]non-existing PPS 0 referenced
[h264 @ 0x7feffc064400]non-existing PPS 0 referenced
[h264 @ 0x7feffc064400]decode_slice_header error
[h264 @ 0x7feffc064400]no frame!
[h264 @ 0x7feffc064400]non-existing PPS 0 referenced
[h264 @ 0x7feffc064400]non-existing PPS 0 referenced
[h264 @ 0x7feffc064400]decode_slice_header error
[h264 @ 0x7feffc064400]no frame!

Why won't this work? How should you multicast an existing raw H264 data stream?

EDIT: As requested, when I run the above ffmpeg command, this is what is produced:

ffmpeg version 2.4.2 Copyright (c) 2000-2014 the FFmpeg developers
  built on Oct 15 2014 06:19:14 with gcc 4.8.2 (GCC) 20131219 (prerelease)
  configuration: --prefix=/usr --disable-debug --disable-static --enable-avisynth --enable-avresample --enable-decoder=atrac3 --enable-decoder=atrac3p --enable-dxva2 --enable-fontconfig --enable-gnutls --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-pic --enable-postproc --enable-runtime-cpudetect --enable-shared --enable-swresample --enable-vdpau --enable-version3 --enable-x11grab
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  4.101 / 56.  4.101
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  1.100 /  5.  1.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
[h264 @ 0x1472380] missing picture in access unit with size 27
[h264 @ 0x1472380] no frame!
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 64.162569, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p, 1280x720, -5 kb/s, 30 fps, 30 tbr, 1000k tbn, 2000k tbc
Output #0, rtp, to 'rtp://224.0.1.2:5001':
  Metadata:
    encoder         : Lavf56.4.101
    Stream #0:0: Video: h264, yuv420p, 1280x720, q=2-31, -5 kb/s, 30 fps, 90k tbn, 1000k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 224.0.1.2
t=0 0
a=tool:libavformat 56.4.101
m=video 5001 RTP/AVP 96
b=AS:-5
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1

Press [q] to stop, [?] for help
frame=  438 fps= 46 q=-1.0 Lsize=    3823kB time=00:00:14.34 bitrate=2183.2kbits/s    
video:3788kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.942992%

I think the problem may lie with the two [h264 @ lines. The more I am investigating, the more it seems like the H264 stream coming from the camera is either missing keyframes, or some kind of info frame explaining what the video size is. Can this "metadata" be added by ffmpeg without transcoding, if it is indeed the problem?

  • You should show the complete console output from your ffmpeg command. – llogan Oct 22 '14 at 19:42
  • @LordNeckbeard: Thanks - I've added the ffmpeg output. – Malvineous Oct 23 '14 at 1:53

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.