Estou usando uma placa de pi-framboesa e uma câmera USB acoplada a ela. eu uso avconv ferramenta para capturar vídeo ao vivo da câmera e streaming-lo na rede usando o protocolo rtp.
Meu comando no servidor (placa raspberry-pi) é como abaixo:
avconv -f video4linux2 -s 160x120 -i / dev / video0 -vcodec mpeg2video -r 25 -pix_fmt yuv420p -me_method ZPEs -b 2600k -BT 256k -f rtp rtp: //192.168.1.141: 8554
Ostreaming funciona com sucesso usando este comando. Aqui o endereço IP 192.168.1.141 é o endereço IP do meu PC cliente. Eu posso reproduzir streaming ao vivo no lado do cliente usando vlc com sucesso.
Mas o problema é que, após algum tempo, a codificação e a transmissão no servidor param automaticamente. E o comando está pendurado lá.
A saída no servidor é a seguinte:
$ avconv -f video4linux2 -s 160x120 -v debug -i /dev/video0 -vcodec mpeg2video -r 25 -pix_fmt yuv420p -me_method epzs -b 2600k -bt 256k -f rtp rtp://192.168.1.141:8554
avconv version 0.8.10-6:0.8.10-1+rpi1, Copyright (c) 2000-2013 the Libav developers
built on Mar 22 2014 02:13:15 with gcc 4.6.3
configuration: --arch=arm --enable-pthreads --enable-runtime-cpudetect --extra-version='6:0.8.10-1+rpi1' --libdir=/usr/lib/arm-linux-gnueabihf --prefix=/usr --disable-yasm --enable-bzlib --enable-libdc1394 --enable-libdirac --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-swscale --enable-libcdio --enable-x11grab --enable-libx264 --enable-libxvid --shlibdir=/usr/lib/arm-linux-gnueabihf --enable-shared --disable-static
libavutil 51. 22. 2 / 51. 22. 2
libavcodec 53. 35. 0 / 53. 35. 0
libavformat 53. 21. 1 / 53. 21. 1
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 15. 0 / 2. 15. 0
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 52. 0. 0 / 52. 0. 0
[video4linux2 @ 0x54d7a0] [4]Capabilities: 84000001
[video4linux2 @ 0x54d7a0] The V4L2 driver changed the pixel format from 0x32315559 to 0x56595559
Last message repeated 1 times
[video4linux2 @ 0x54d7a0] The V4L2 driver changed the pixel format from 0x50323234 to 0x56595559
[video4linux2 @ 0x54d7a0] The V4L2 driver set input_id: 0, input: Camera 1
[rawvideo @ 0x54f860] err{or,}_recognition separate: 1; 1
[rawvideo @ 0x54f860] err{or,}_recognition combined: 1; 1
[video4linux2 @ 0x54d7a0] All info found
[video4linux2 @ 0x54d7a0] Estimating duration from bitrate, this may be inaccurate
Input #0, video4linux2, from '/dev/video0':
Duration: N/A, start: 21891.364784, bitrate: 9216 kb/s
Stream #0.0, 1, 1/1000000: Video: rawvideo, yuyv422, 160x120, 1/30, 9216 kb/s, 30 tbr, 1000k tbn, 30 tbc
[buffer @ 0x54f220] w:160 h:120 pixfmt:yuyv422
[avsink @ 0x54d740] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 0x54f7e0] w:160 h:120 fmt:yuyv422 -> w:160 h:120 fmt:yuv420p flags:0x4
[mpeg2video @ 0x54ea60] err{or,}_recognition separate: 1; 1
[mpeg2video @ 0x54ea60] err{or,}_recognition combined: 1; 1
[mpeg2video @ 0x54ea60] detected 1 logical cores
[mpeg2video @ 0x54ea60] Unsupported bit depth: 0
[rawvideo @ 0x54f860] err{or,}_recognition separate: 1; 1
[rawvideo @ 0x54f860] err{or,}_recognition combined: 1; 1
Output #0, rtp, to 'rtp://192.168.1.141:8554':
Metadata:
encoder : Lavf53.21.1
Stream #0.0, 0, 1/90000: Video: mpeg2video, yuv420p, 160x120, 1/25, q=2-31, 2600 kb/s, 90k tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo -> mpeg2video)
SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 192.168.1.141
t=0 0
a=tool:libavformat 53.21.1
m=video 8554 RTP/AVP 32
b=AS:2600
Press ctrl-c to stop encoding
*** drop!
Last message repeated 1 times
*** 1 dup!
*** 16 dup! fps= 25 q=2.0 size= 1027kB time=5.24 bitrate=1605.2kbits/s dup=1 drop=2
*** drop!
Last message repeated 11 times
*** drop!49 fps= 26 q=2.0 size= 1059kB time=5.92 bitrate=1464.9kbits/s dup=17 drop=14
Last message repeated 2 times
*** drop!76 fps= 25 q=2.0 size= 2022kB time=11.00 bitrate=1505.7kbits/s dup=17 drop=17
*** drop!48 fps= 25 q=2.0 size= 4086kB time=21.88 bitrate=1529.8kbits/s dup=17 drop=18
*** 1 dup!
*** 1 dup!0 fps= 25 q=2.0 size= 4171kB time=22.36 bitrate=1528.2kbits/s dup=18 drop=19
*** 1 dup!1 fps= 25 q=2.0 size= 4859kB time=26.00 bitrate=1530.8kbits/s dup=19 drop=19
*** 1 dup!0 fps= 25 q=2.0 size= 5152kB time=27.56 bitrate=1531.5kbits/s dup=20 drop=19
*** 1 dup!3 fps= 25 q=2.0 size= 5250kB time=28.08 bitrate=1531.7kbits/s dup=21 drop=19
*** drop!64 fps= 25 q=2.0 size= 7215kB time=38.52 bitrate=1534.5kbits/s dup=22 drop=19
*** 1 dup!6 fps= 25 q=2.0 size= 7306kB time=39.00 bitrate=1534.6kbits/s dup=22 drop=20
*** drop!07 fps= 25 q=2.0 size= 8288kB time=44.24 bitrate=1534.7kbits/s dup=23 drop=20
*** 1 dup!0 fps= 25 q=2.0 size= 10054kB time=53.56 bitrate=1537.8kbits/s dup=23 drop=21
*** 1 dup!9 fps= 25 q=2.0 size= 10342kB time=55.12 bitrate=1537.1kbits/s dup=24 drop=21
Last message repeated 1 times
*** drop!93 fps= 25 q=1.6 size= 10445kB time=55.68 bitrate=1536.7kbits/s dup=26 drop=21
*** 1 dup!
*** 7036829 dup! 25 q=2.0 size= 10630kB time=56.68 bitrate=1536.4kbits/s dup=27 drop=22
Alguma idéia?
Obrigado antecipadamente.
EDITAR:
Saída de v4l2-CTL --list-formatos-ext comando é como abaixo:
pi@raspberrypi ~ $ v4l2-ctl --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: 'YUYV'
Name : YUV 4:2:2 (YUYV)
Size: Discrete 640x480
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 352x288
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 320x240
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 176x144
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 160x120
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)