FFmpeg:来自网络摄像头的部分图像(覆盖 8 且 EOI 缺失,模拟)

FFmpeg:来自网络摄像头的部分图像(覆盖 8 且 EOI 缺失,模拟)

我在对网络摄像头的视频进行编码时遇到了困难。当我选择 320x240 或更高的分辨率时,视频帧只能部分保存,其余部分则被绿色图块覆盖。这是屏幕截图。 这是另一个。

这是我在 160x120 下运行时得到的结果,效果很好。(不知道是什么重读 8意思是虽然。)

$ ./ffmpeg -f v4l2 -c:v mjpeg -video_size 160x120 -i /dev/video0 -r 10  output.mp4
ffmpeg version N-81447-gc1de1f0 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
  configuration: --prefix=/home/reccsi/Dev/build-x64/ffmpeg/ --pkg-config-flags=--static --enable-shared --enable-libvpx --enable-libvorbis
  libavutil      55. 29.100 / 55. 29.100
  libavcodec     57. 54.100 / 57. 54.100
  libavformat    57. 48.100 / 57. 48.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 54.100 /  6. 54.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
[mjpeg @ 0x764860] EOI missing, emulating
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 202311.110780, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 160x120, -5 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
[swscaler @ 0x775b20] deprecated pixel format used, make sure you did set range correctly
[mp4 @ 0x7666a0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, mp4, to 'output.mp4':
  Metadata:
    encoder         : Lavf57.48.100
    Stream #0:0: Video: mpeg4 ( [0][0][0] / 0x0020), yuv420p, 160x120, q=2-31, 200 kb/s, 10 fps, 10240 tbn, 10 tbc
    Metadata:
      encoder         : Lavc57.54.100 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
[mjpeg @ 0x765380] overread 8
[mjpeg @ 0x765380] EOI missing, emulating
frame=   76 fps= 11 q=2.0 Lsize=      65kB time=00:00:07.50 bitrate=  71.5kbits/s dup=37 drop=171 speed=1.07x    
video:64kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.805016%

这是我以 320x240 运行时遇到的情况,它不起作用:

./ffmpeg -f v4l2 -c:v mjpeg -video_size 320x240 -i /dev/video0 -r 10  output2.mp4
ffmpeg version N-81447-gc1de1f0 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
  configuration: --prefix=/home/reccsi/Dev/build-x64/ffmpeg/ --pkg-config-flags=--static --enable-shared --enable-libvpx --enable-libvorbis
  libavutil      55. 29.100 / 55. 29.100
  libavcodec     57. 54.100 / 57. 54.100
  libavformat    57. 48.100 / 57. 48.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 54.100 /  6. 54.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
[mjpeg @ 0x1c7f860] EOI missing, emulating
[mjpeg @ 0x1c7f860] No JPEG data found in image
[mjpeg @ 0x1c7f860] Single field
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 202370.864636, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 160x240, -5 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
[swscaler @ 0x1c90b20] deprecated pixel format used, make sure you did set range correctly
[mp4 @ 0x1c816a0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, mp4, to 'output2.mp4':
  Metadata:
    encoder         : Lavf57.48.100
    Stream #0:0: Video: mpeg4 ( [0][0][0] / 0x0020), yuv420p, 160x240, q=2-31, 200 kb/s, 10 fps, 10240 tbn, 10 tbc
    Metadata:
      encoder         : Lavc57.54.100 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] No JPEG data found in image
Error while decoding stream #0:0: Invalid data found when processing input
[mjpeg @ 0x1c80380] No JPEG data found in image
Error while decoding stream #0:0: Invalid data found when processing input
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
Input stream #0:0 frame changed from size:160x240 fmt:yuvj422p to size:320x240 fmt:yuvj422p
[swscaler @ 0x1c909e0] deprecated pixel format used, make sure you did set range correctly
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8=       7kB time=00:00:00.60 bitrate=  92.3kbits/s speed= 1.2x    
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 6
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8=      14kB time=00:00:01.10 bitrate= 104.7kbits/s dup=1 drop=10 speed= 1.1x    
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 7
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8
[mjpeg @ 0x1c80380] EOI missing, emulating
[mjpeg @ 0x1c80380] overread 8=      34kB time=00:00:01.80 bitrate= 154.6kbits/s dup=2 drop=20 speed= 1.2x    
[mjpeg @ 0x1c80380] EOI missing, emulating
frame=   15 fps=9.5 q=2.0 Lsize=      35kB time=00:00:01.80 bitrate= 158.6kbits/s dup=2 drop=22 speed=1.14x    
video:34kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.697101%

我在 Ubuntu 14.04 LTS 上运行,我的网络摄像头信息如下:

$ ./ffmpeg -f v4l2 -list_formats all -i /dev/video0
ffmpeg version N-81447-gc1de1f0 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
  configuration: --prefix=/home/reccsi/Dev/build-x64/ffmpeg/ --pkg-config-flags=--static --enable-shared --enable-libvpx --enable-libvorbis
  libavutil      55. 29.100 / 55. 29.100
  libavcodec     57. 54.100 / 57. 54.100
  libavformat    57. 48.100 / 57. 48.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 54.100 /  6. 54.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
[video4linux2,v4l2 @ 0x1e50380] Compressed:       mjpeg :          Motion-JPEG : 640x480 160x120 176x144 320x240 352x288 800x600 1024x768 1280x1024 1600x1200
[video4linux2,v4l2 @ 0x1e50380] Raw       :     yuyv422 :           YUYV 4:2:2 : 640x480 160x120 176x144 320x240 352x288
/dev/video0: Immediate exit requested

额外的

我在戴尔显示器上使用集成网络摄像头。在 VMware 的可移动设备列表中,它显示为“OmniVision Monitor 集成网络摄像头”。我尝试获取原始输入,但它一直停留在那里,直到我中止程序。

./ffmpeg -f v4l2 -input_format yuyv422 -video_size 160x120 -i /dev/video0 output.mp4
ffmpeg version N-81447-gc1de1f0 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
  configuration: --prefix=/home/reccsi/Dev/build-x64/ffmpeg/ --pkg-config-flags=--static --enable-shared --enable-libvpx --enable-libvorbis
  libavutil      55. 29.100 / 55. 29.100
  libavcodec     57. 54.100 / 57. 54.100
  libavformat    57. 48.100 / 57. 48.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 54.100 /  6. 54.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
^CInput #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, bitrate: 9216 kb/s
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 160x120, 9216 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
(...wait indefinitely)

相关内容