3

我正在尝试以下命令,以便我的网络摄像头在我从网络或 android 模拟器访问它时显示视频。

我正在使用archlinux。我已经安装了 v4l2loopback-dkms。并将模块添加到内核中。然后我启动了

gst-launch-0.10 filesrc location=/home/simha/1.3gp ! decodebin2 ! ffmpegcolorspace ! videoscale ! ffmpegcolorspace ! v4l2sink device=/dev/video0

但没有成功。

Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0: Device '/dev/video0' is not a output device.
Additional debug info:
v4l2_calls.c(528): gst_v4l2_open (): /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0:
Capabilities: 0x85200001
Setting pipeline to NULL ...
Freeing pipeline ...

也试过:

ffmpeg -f x11grab -r 15 -s 1280x720 -i :0.0+0,0 -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0

但不工作

ffmpeg version 2.8 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 5.2.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-shared --enable-version3 --enable-x11grab
  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
Input #0, x11grab, from ':0.0+0,0':
  Duration: N/A, start: 1456374857.672770, bitrate: N/A
    Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1280x720, 15 fps, 15 tbr, 1000k tbn, 15 tbc
[v4l2 @ 0x55f5129180a0] ioctl(VIDIOC_G_FMT): Invalid argument
Output #0, v4l2, to '/dev/video0':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720, q=2-31, 200 kb/s, 15 fps, 15 tbn, 15 tbc
    Metadata:
      encoder         : Lavc56.60.100 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
4

1 回答 1

0

您可能为网络摄像头使用了错误的驱动程序。使用该lsusb命令来识别您的网络摄像头。然后找出你需要什么驱动程序才能让它工作。您可以通过阅读Webcam Arch Wiki 页面了解更多信息

于 2018-01-24T03:13:47.980 回答