Opened 4 months ago

Last modified 4 months ago

#6219 new defect

When h264_omx used, cannot start streaming client after server

Reported by: Luke Owned by:
Priority: normal Component: ffmpeg
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I am trying to stream a webcam to the network through the RDP protocol on a raspberry pi 2 B.

The problem is by doing so, I have to start the client (ffplay or vlc) first in order to receive images. If I start ffmpeg streaming first and THEN the client (ffplay or vlc), no images are displayed and ffplay outputs error messages:

[h264 @ 0x7f04340008c0] non-existing PPS 0 referenced    0B f=0/0
    Last message repeated 1 times
[h264 @ 0x7f04340008c0] decode_slice_header error
[h264 @ 0x7f04340008c0] no frame!

On the raspberry, here is the command I use to stream:

ffmpeg -i /dev/video0 -vcodec h264_omx -f rtp rtp://192.168.0.101:1234

On the client, to display the stream I first save the SDP file provided by ffmpeg on its output and do:

ffplay sdp.out

At the bottom of this description you will find a couple of investigations I made to prove the problem comes from the video encoder, but for the sake of compliance with the bug report rules, here is now the output of ffmpeg (ffmpeg -v 9 -loglevel 99 -i ...):

ffmpeg started on 2017-03-05 at 07:42:24
Report written to "ffmpeg-20170305-074224.log"
Command line:
./ffmpeg -report -v 9 -loglevel 99 -i /dev/video0 -vcodec h264_omx -f rtp rtp://192.168.0.101:1234
ffmpeg version git-2017-03-01-70ebc05 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.8.3 (crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03) 20140303 (prerelease)
  configuration: --enable-cross-compile --arch=armel --cpu=cortex-a7 --target-os=linux --sysroot=/home/jedi/rpi-toolchain/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/libc --sysinclude=/home/jedi/rpi-toolchain/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/lib/gcc/arm-linux-gnueabihf/4.8.3/include --cross-prefix=/home/jedi/rpi-toolchain/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- --prefix=/tmp/ --enable-mmal --enable-omx-rpi --extra-cflags='-I../userland/ -I../userland/interface/vmcs_host/khronos/IL/ -I../userland/host_applications/linux/libs/bcm_host/include/' --extra-ldflags=-L../userland/build/lib/ --extra-libs='-lmmal_core -lmmal -lmmal_util -lvcos -lcontainers -lbcm_host -lmmal_vc_client -lmmal_components -lvchiq_arm -lvcsm'
  libavutil      55. 47.100 / 55. 47.100
  libavcodec     57. 81.101 / 57. 81.101
  libavformat    57. 66.102 / 57. 66.102
  libavdevice    57.  3.100 / 57.  3.100
  libavfilter     6. 74.100 /  6. 74.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
Splitting the commandline.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-i' ... matched as input url with argument '/dev/video0'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'h264_omx'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'rtp'.
Reading option 'rtp://192.168.0.101:1234' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Applying option v (set logging level) with argument 9.
Applying option loglevel (set logging level) with argument 99.
Successfully parsed a group of options.
Parsing a group of options: input url /dev/video0.
Successfully parsed a group of options.
Opening an input file: /dev/video0.
[video4linux2,v4l2 @ 0x352b420] fd:5 capabilities:84200001
[video4linux2,v4l2 @ 0x352b420] Current input_channel: 0, input_name: Camera 1, input_std: 0
[video4linux2,v4l2 @ 0x352b420] Querying the device for the current frame size
[video4linux2,v4l2 @ 0x352b420] Setting frame size to 640x480
[video4linux2,v4l2 @ 0x352b420] The V4L2 driver changed the pixel format from 0x32315559 to 0x56595559
[video4linux2,v4l2 @ 0x352b420] Trying to set codec:rawvideo pix_fmt:yuv420p
[video4linux2,v4l2 @ 0x352b420] The V4L2 driver changed the pixel format from 0x32315559 to 0x56595559
[video4linux2,v4l2 @ 0x352b420] Trying to set codec:rawvideo pix_fmt:yuv420p
[video4linux2,v4l2 @ 0x352b420] The V4L2 driver changed the pixel format from 0x32315659 to 0x56595559
[video4linux2,v4l2 @ 0x352b420] Trying to set codec:rawvideo pix_fmt:yuv422p
[video4linux2,v4l2 @ 0x352b420] The V4L2 driver changed the pixel format from 0x50323234 to 0x56595559
[video4linux2,v4l2 @ 0x352b420] Trying to set codec:rawvideo pix_fmt:yuyv422
[video4linux2,v4l2 @ 0x352b420] All info found
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 3134.382943, bitrate: 147456 kb/s
    Stream #0:0, 1, 1/1000000: Video: rawvideo, 1 reference frame (YUY2 / 0x32595559), yuyv422, 640x480, 0/1, 147456 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Successfully opened the file.
Parsing a group of options: output url rtp://192.168.0.101:1234.
Applying option vcodec (force video codec ('copy' to copy stream)) with argument h264_omx.
Applying option f (force format) with argument rtp.
Successfully parsed a group of options.
Opening an output file: rtp://192.168.0.101:1234.
[rtp @ 0x352f070] No default whitelist set
[udp @ 0x352f280] No default whitelist set
[udp @ 0x353f6c0] No default whitelist set
Successfully opened the file.
detected 4 logical cores
[graph 0 input from stream 0:0 @ 0x353f5e0] Setting 'video_size' to value '640x480'
[graph 0 input from stream 0:0 @ 0x353f5e0] Setting 'pix_fmt' to value '1'
[graph 0 input from stream 0:0 @ 0x353f5e0] Setting 'time_base' to value '1/1000000'
[graph 0 input from stream 0:0 @ 0x353f5e0] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 0:0 @ 0x353f5e0] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0x353f5e0] Setting 'frame_rate' to value '30/1'
[graph 0 input from stream 0:0 @ 0x353f5e0] w:640 h:480 pixfmt:yuyv422 tb:1/1000000 fr:30/1 sar:0/1 sws_param:flags=2
[format @ 0x3550fe0] compat: called with args=[yuv420p]
[format @ 0x3550fe0] Setting 'pix_fmts' to value 'yuv420p'
[auto_scaler_0 @ 0x3551440] Setting 'flags' to value 'bicubic'
[auto_scaler_0 @ 0x3551440] w:iw h:ih flags:'bicubic' interl:0
[format @ 0x3550fe0] auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_null_0' and the filter 'format'
[AVFilterGraph @ 0x35504e0] query_formats: 4 queried, 2 merged, 1 already done, 0 delayed
[auto_scaler_0 @ 0x3551440] w:640 h:480 fmt:yuyv422 sar:0/1 -> w:640 h:480 fmt:yuv420p sar:0/1 flags:0x4
[h264_omx @ 0x352e620] Using OMX.broadcom.video_encode
[h264_omx @ 0x352e620] OMX state changed to 2
[h264_omx @ 0x352e620] OMX state changed to 3
[h264_omx @ 0x352e620] OMX port 201 settings changed
Output #0, rtp, to 'rtp://192.168.0.101:1234':
  Metadata:
    encoder         : Lavf57.66.102
    Stream #0:0, 0, 1/90000: Video: h264 (h264_omx), 1 reference frame, yuv420p, 640x480, 0/1, q=2-31, 200 kb/s, 30 fps, 90k tbn, 30 tbc
    Metadata:
      encoder         : Lavc57.81.101 h264_omx
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_omx))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
Clipping frame in rate conversion by 0.000008
[rtp @ 0x352d350] Sending NAL 7 of len 14 M=0
[rtp @ 0x352d350] Sending NAL 8 of len 5 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 56 dup!
[rtp @ 0x352d350] Sending NAL 5 of len 2058 M=1
[rtp @ 0x352d350] NAL size 2058 > 1460
[rtp @ 0x352d350] Sending NAL 1 of len 307 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 58 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 24 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 14 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 14 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 14 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 14 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 14 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 14 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 14 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 14 M=1
[rtp @ 0x352d350] Sending NAL 5 of len 2565 M=1
[rtp @ 0x352d350] NAL size 2565 > 1460
[rtp @ 0x352d350] Sending NAL 1 of len 374 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 80 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 23 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 5 of len 3051 M=1
[rtp @ 0x352d350] NAL size 3051 > 1460
[rtp @ 0x352d350] Sending NAL 1 of len 442 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 202 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 33 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 27 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 16 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 5 of len 3533 M=1
[rtp @ 0x352d350] NAL size 3533 > 1460
[rtp @ 0x352d350] Sending NAL 1 of len 448 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 224 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 36 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 5 of len 4147 M=1
[rtp @ 0x352d350] NAL size 4147 > 1460
[rtp @ 0x352d350] Sending NAL 1 of len 523 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 130 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 25 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 17 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 15 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 350 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 3 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 662 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 249 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 87 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 5 of len 4962 M=1
[rtp @ 0x352d350] NAL size 4962 > 1460
[rtp @ 0x352d350] Sending NAL 1 of len 580 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 3 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 701 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 510 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 118 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 30 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 597 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 1040 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 839 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 880 M=1
frame=   72 fps=0.0 q=-0.0 size=      31kB time=00:00:02.30 bitrate= 109.6kbits/s dup=65 drop=0 speed= 4.5x    
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 1205 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 101 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 5 of len 7281 M=1
[rtp @ 0x352d350] NAL size 7281 > 1460
[rtp @ 0x352d350] Sending NAL 1 of len 673 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 1170 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 96 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 613 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 589 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 789 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 189 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 683 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 631 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 1054 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 297 M=1
frame=   86 fps= 85 q=-0.0 size=      46kB time=00:00:02.76 bitrate= 136.2kbits/s dup=72 drop=0 speed=2.72x    
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 5 of len 8736 M=1
[rtp @ 0x352d350] NAL size 8736 > 1460
[rtp @ 0x352d350] Sending NAL 1 of len 736 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 1618 M=1
[rtp @ 0x352d350] NAL size 1618 > 1460
[rtp @ 0x352d350] Sending NAL 1 of len 143 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 723 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 626 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
[rtp @ 0x352d350] Sending NAL 1 of len 834 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 2 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 138 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 872 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 203 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
[rtp @ 0x352d350] Sending NAL 1 of len 859 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 221 M=1
[rtp @ 0x352d350] Sending NAL 5 of len 9739 M=1
[rtp @ 0x352d350] NAL size 9739 > 1460
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 783 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 2074 M=1
[rtp @ 0x352d350] NAL size 2074 > 1460
frame=  101 fps= 66 q=-0.0 size=      74kB time=00:00:03.26 bitrate= 185.5kbits/s dup=79 drop=0 speed=2.14x    
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 135 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 896 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 194 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 614 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 435 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 851 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 380 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 853 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 212 M=1
[rtp @ 0x352d350] Sending NAL 5 of len 9784 M=1
[rtp @ 0x352d350] NAL size 9784 > 1460
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 820 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 2060 M=1
[rtp @ 0x352d350] NAL size 2060 > 1460
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 211 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 874 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 72 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 347 M=1
frame=  117 fps= 58 q=-0.0 size=      93kB time=00:00:03.80 bitrate= 199.6kbits/s dup=87 drop=0 speed=1.88x    
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 429 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 551 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 440 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 801 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 193 M=1
[rtp @ 0x352d350] Sending NAL 5 of len 8740 M=1
[rtp @ 0x352d350] NAL size 8740 > 1460
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 717 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 1564 M=1
[rtp @ 0x352d350] NAL size 1564 > 1460
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 127 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 876 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 128 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 330 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 60 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 284 M=1
frame=  131 fps= 52 q=-0.0 size=     108kB time=00:00:04.26 bitrate= 206.8kbits/s dup=94 drop=0 speed=1.69x    
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 308 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 376 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 51 M=1
[rtp @ 0x352d350] Sending NAL 5 of len 7345 M=1
[rtp @ 0x352d350] NAL size 7345 > 1460
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 656 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 1079 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 76 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 289 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 55 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 407 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 87 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 212 M=1
[rawvideo @ 0x352cf40] PACKET SIZE: 614400, STRIDE: 1280
*** 1 dup!
[rtp @ 0x352d350] Sending NAL 1 of len 36 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 154 M=1
[rtp @ 0x352d350] Sending NAL 1 of len 19 M=1
[rtp @ 0x352d350] Sending NAL 5 of len 6654 M=1
[rtp @ 0x352d350] NAL size 6654 > 1460
frame=  145 fps= 48 q=-0.0 Lsize=     125kB time=00:00:04.80 bitrate= 214.0kbits/s dup=101 drop=0 speed=1.59x    
video:124kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.513044%
Input file #0 (/dev/video0):
  Input stream #0:0 (video): 44 packets read (27033600 bytes); 44 frames decoded; 
  Total: 44 packets (27033600 bytes) demuxed
Output file #0 (rtp://192.168.0.101:1234):
  Output stream #0:0 (video): 145 frames encoded; 146 packets muxed (126500 bytes); 
  Total: 146 packets (126500 bytes) muxed
44 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x353f500] Statistics: 0 seeks, 197 writeouts
[h264_omx @ 0x352e620] OMX state changed to 2
[h264_omx @ 0x352e620] OMX state changed to 1
Exiting normally, received signal 2.

Someone at video.exchange.com told me to force the IFrame from being generated, so I tried:

ffmpeg -i /dev/video0 -force_key_frames 'expr:gte(t,n_forced)'  -vcodec h264_omx -f rtp rtp://192.168.0.101:1234

It didn't work so I tried on my desktop. Without the -force_key_frame option and by using libx264 codec, the result is the same as on the raspberry, ffplay cannot catch the feed in the middle of a stream (has to be started first). But when I use the option aforementioned, ffplay is able to catch on:

ffmpeg -i /dev/video0 -force_key_frames 'expr:gte(t,n_forced)' -vcodec libx264 -f rtp rtp://127.0.0.1:1234

So the problem does not comes from the rtp protocol neither.
I tried to output the stream to a file and analyze it with ffprob like so:

ffprobe -i /tmp/file.avi -select_streams v -show_frames -of csv -show_entries frame=pict_type

On both the raspberry and the desktop and the result is pretty much the same, IFrame seems generated:

frame,I
frame,P
frame,P
frame,P
frame,P
frame,P
frame,P
frame,P
frame,P
frame,P
frame,P
frame,P
frame,I
frame,P
frame,P
[...]

Finally, for the sake of full disclosure, the ffmpeg binary I use on the raspberry pi has been compiled with the following configure option:

./configure --enable-cross-compile --arch=armel --cpu=cortex-a7 --target-os=linux --sysroot=${PI_TOOLS_HOME}/${PI_TOOL}/arm-linux-gnueabihf/libc --sysinclude=${PI_TOOLS_HOME}/${PI_TOOL}/lib/gcc/arm-linux-gnueabihf/4.8.3/include --cross-prefix=${PI_TOOLS_HOME}/${PI_TOOL}/bin/arm-linux-gnueabihf- --prefix=/tmp/ --enable-mmal --enable-omx-rpi --enable-omx --extra-cflags="-I../userland/ -I../userland/interface/vmcs_host/khronos/IL/ -I../userland/host_applications/linux/libs/bcm_host/include/" --extra-ldflags="-L../userland/build/lib/" --extra-libs="-lmmal_core -lmmal -lmmal_util -lvcos -lcontainers -lbcm_host -lmmal_vc_client -lmmal_components -lvchiq_arm -lvcsm"

Change History (3)

comment:1 Changed 4 months ago by Luke

  • Component changed from undetermined to ffserver
  • Version changed from unspecified to git-master

comment:2 Changed 4 months ago by Luke

  • Component changed from ffserver to ffmpeg

comment:3 Changed 4 months ago by Luke

  • Summary changed from Streaming issue with h264_omx on Raspberry to When h264_omx used, cannot start streaming client after server
Note: See TracTickets for help on using tickets.