在 ARM 主板 (i.MX6) 中进行 USB 网络摄像头流式传输



我想通过网络流式传输相机。我已经将 USB 网络摄像头连接到 i.MX6 板,并希望通过网络在 Ubuntu14.04/16.04 中进行流式传输。

顺便说一下,我已经在i.MX6板中安装了gstreamer和ffmpeg工具。

此外,我还可以使用以下 ffmpeg 命令在 Ubuntu14.04 PC 中流式传输 USB 网络摄像头。但是如果我在其他 Ubuntu16.04 中使用 ffplay 并且我不确定为什么(两者都是相同的 ffmpeg 版本(,它也不起作用。

ffmpeg -f v4l2 -i /dev/video0 -preset ultrafast -vcodec libx264 -tune zerolatency -b 900k -f mpegts udp://192.168.0.37:1234
ffplay udp://192.168.0.37:1234

Ubuntu 16.06:(不工作(

tus@titus-PC:~/workdir$ ffplay udp://192.168.0.105:1234
ffplay version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2003-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil      54. 31.100 / 54. 31.100
libavcodec     56. 60.100 / 56. 60.100
libavformat    56. 40.101 / 56. 40.101
libavdevice    56.  4.100 / 56.  4.100
libavfilter     5. 40.101 /  5. 40.101
libavresample   2.  1.  0 /  2.  1.  0
libswscale      3.  1.101 /  3.  1.101
libswresample   1.  2.101 /  1.  2.101
libpostproc    53.  3.100 / 53.  3.100
nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0  

Ubuntu 14.04:(工作(

titus@titus-laptop:~$ 
titus@titus-laptop:~$ ffplay udp://127.0.0.1:1234
ffplay version 3.3.2 Copyright (c) 2003-2017 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libtheora --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab --enable-libwavpack --enable-nvenc
libavutil      55. 58.100 / 55. 58.100
libavcodec     57. 89.100 / 57. 89.100
libavformat    57. 71.100 / 57. 71.100
libavdevice    57.  6.100 / 57.  6.100
libavfilter     6. 82.100 /  6. 82.100
libavresample   3.  5.  0 /  3.  5.  0
libswscale      4.  6.100 /  4.  6.100
libswresample   2.  7.100 /  2.  7.100
libpostproc    54.  5.100 / 54.  5.100
[h264 @ 0xb0621660] non-existing PPS 0 referenced sq=    0B f=0/0   
Last message repeated 1 times
[h264 @ 0xb0621660] decode_slice_header error
[h264 @ 0xb0621660] non-existing PPS 0 referenced
[h264 @ 0xb0621660] decode_slice_header error
[h264 @ 0xb0621660] non-existing PPS 0 referenced
[h264 @ 0xb0621660] decode_slice_header error
[h264 @ 0xb0621660] non-existing PPS 0 referenced
[h264 @ 0xb0621660] decode_slice_header error
[h264 @ 0xb0621660] no frame!
[h264 @ 0xb0621660] non-existing PPS 0 referenced sq=    0B f=0/0   
1751.47 M-V: -0.021 fd=   0 aq=    0KB vq=   11KB sq=    0B f=0/0   
1751.63 M-V: -0.020 fd=   0 aq=    0KB vq=   11KB sq=    0B f=0/0   
1751.80 M-V: -0.020 fd=   0 aq=    0KB vq=   11KB sq=    0B f=0/0 

最后,我想使用不同的 ARM 板进行流式传输。我也无法构建 ffplay 命令。树莓派也有同样的问题。我在这里做错了什么或误解了什么?

您想要将实时 USB 摄像头源从 iMX6 流式传输到 PC。假设我理解正确,在 iMX6 上运行以下管道

gst-launch-1.0 imxv4l2src device=/dev/video3 ! videoconvert ! queue ! vpuenc_h264 ! rtph264pay ! udpsink host=10.18.0.125 port=5004

并通过在我的 PC 上运行以下管道

gst-launch-1.0 udpsrc port=5004 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, payload=(int)96, encoding-name=(string)H264" ! rtph264depay ! avdec_h264 ! xvimagesink

我可以在PC上查看USB相机流。

最新更新