1

У меня проблемы с кодированием видео с моей веб-камеры. Когда я выбираю разрешение 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%

Вот что я имею при работе с 320х240, который не работает:

./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

дополнительный

Я использую встроенную веб-камеру на мониторе Dell. В списке сменных устройств 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)

0