DirectShow-Videoaufnahme als MPEG-4 mit FFmpeg

1235
Brad

Bei Verwendung des FFmpeg-Modul dshow werden MJPEG als Daten von der Webcam verwendet.

Input #0, dshow, from 'video=Logitech HD Pro Webcam C920:audio=CABLE Output (VB-Audio Virtual Cable)': Duration: N/A, start: 17980.693000, bitrate: N/A Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/unknown/unknown), 640x480, 30 tbr, 10000k tbn, 30 tbc Stream #0:1: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s 

Meine Webcam unterstützt die Hardware-MPEG-4-Codierung, die mir definitiv helfen würde, etwas USB-Bandbreite zu sparen, und dann müsste ich nicht in MPEG-4 umcodieren, wodurch eine Menge CPU freigesetzt wird.

Ist es möglich, MPEG-4-Webcams mit DirectShow-API zu verwenden? Und wenn ja, ist dies mit dem FFmpeg-Modul dshow möglich?

Bearbeiten: Ausgabe von -list_options true:

\Brad\bin\ffmpeg -list_options true -f dshow -i video="Logitech HD Pro Webcam C920" ffmpeg version N-67731-gce80f9f Copyright (c) 2000-2014 the FFmpeg developers built on Nov 15 2014 22:54:40 with gcc 4.9.2 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-font config --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable- libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3la me --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --e nable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libw ebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-zlib libavutil 54. 13.100 / 54. 13.100 libavcodec 56. 12.101 / 56. 12.101 libavformat 56. 13.100 / 56. 13.100 libavdevice 56. 3.100 / 56. 3.100 libavfilter 5. 2.103 / 5. 2.103 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 3.100 / 53. 3.100 [dshow @ 0000000002c457c0] DirectShow video device options [dshow @ 0000000002c457c0] Pin "Capture" [dshow @ 0000000002c457c0] pixel_format=bgr24 min s=640x480 fps=5 max s=640x480 fps=30 [dshow @ 0000000002c457c0] pixel_format=bgr24 min s=160x90 fps=5 max s=160x90 fps=30 [dshow @ 0000000002c457c0] pixel_format=bgr24 min s=160x120 fps=5 max s=160x120 fps=30 [dshow @ 0000000002c457c0] pixel_format=bgr24 min s=176x144 fps=5 max s=176x144 fps=30 [dshow @ 0000000002c457c0] pixel_format=bgr24 min s=320x180 fps=5 max s=320x180 fps=30 [dshow @ 0000000002c457c0] pixel_format=bgr24 min s=320x240 fps=5 max s=320x240 fps=30 [dshow @ 0000000002c457c0] pixel_format=bgr24 min s=352x288 fps=5 max s=352x288 fps=30 [dshow @ 0000000002c457c0] pixel_format=bgr24 min s=432x240 fps=5 max s=432x240 fps=30 [dshow @ 0000000002c457c0] pixel_format=bgr24 min s=640x360 fps=5 max s=640x360 fps=30 [dshow @ 0000000002c457c0] pixel_format=bgr24 min s=800x448 fps=5 max s=800x448 fps=30 [dshow @ 0000000002c457c0] pixel_format=bgr24 min s=800x600 fps=5 max s=800x600 fps=30 [dshow @ 0000000002c457c0] pixel_format=bgr24 min s=864x480 fps=5 max s=864x480 fps=30 [dshow @ 0000000002c457c0] pixel_format=bgr24 min s=960x720 fps=5 max s=960x720 fps=30 [dshow @ 0000000002c457c0] pixel_format=bgr24 min s=1024x576 fps=5 max s=1024x576 fps=30 [dshow @ 0000000002c457c0] pixel_format=bgr24 min s=1280x720 fps=5 max s=1280x720 fps=30 [dshow @ 0000000002c457c0] pixel_format=bgr24 min s=1600x896 fps=5 max s=1600x896 fps=30 [dshow @ 0000000002c457c0] pixel_format=bgr24 min s=1920x1080 fps=5 max s=1920x1080 fps=30 [dshow @ 0000000002c457c0] pixel_format=bgr24 min s=2304x1296 fps=2 max s=2304x1296 fps=2 [dshow @ 0000000002c457c0] pixel_format=bgr24 min s=2304x1536 fps=2 max s=2304x1536 fps=2 [dshow @ 0000000002c457c0] pixel_format=yuv420p min s=640x480 fps=5 max s=640x480 fps=30 [dshow @ 0000000002c457c0] pixel_format=yuv420p min s=160x90 fps=5 max s=160x90 fps=30 [dshow @ 0000000002c457c0] pixel_format=yuv420p min s=160x120 fps=5 max s=160x120 fps=30 [dshow @ 0000000002c457c0] pixel_format=yuv420p min s=176x144 fps=5 max s=176x144 fps=30 [dshow @ 0000000002c457c0] pixel_format=yuv420p min s=320x180 fps=5 max s=320x180 fps=30 [dshow @ 0000000002c457c0] pixel_format=yuv420p min s=320x240 fps=5 max s=320x240 fps=30 [dshow @ 0000000002c457c0] pixel_format=yuv420p min s=352x288 fps=5 max s=352x288 fps=30 [dshow @ 0000000002c457c0] pixel_format=yuv420p min s=432x240 fps=5 max s=432x240 fps=30 [dshow @ 0000000002c457c0] pixel_format=yuv420p min s=640x360 fps=5 max s=640x360 fps=30 [dshow @ 0000000002c457c0] pixel_format=yuv420p min s=800x448 fps=5 max s=800x448 fps=30 [dshow @ 0000000002c457c0] pixel_format=yuv420p min s=800x600 fps=5 max s=800x600 fps=30 [dshow @ 0000000002c457c0] pixel_format=yuv420p min s=864x480 fps=5 max s=864x480 fps=30 [dshow @ 0000000002c457c0] pixel_format=yuv420p min s=960x720 fps=5 max s=960x720 fps=30 [dshow @ 0000000002c457c0] pixel_format=yuv420p min s=1024x576 fps=5 max s=1024x576 fps=30 [dshow @ 0000000002c457c0] pixel_format=yuv420p min s=1280x720 fps=5 max s=1280x720 fps=30 [dshow @ 0000000002c457c0] pixel_format=yuv420p min s=1600x896 fps=5 max s=1600x896 fps=30 [dshow @ 0000000002c457c0] pixel_format=yuv420p min s=1920x1080 fps=5 max s=1920x1080 fps=30 [dshow @ 0000000002c457c0] pixel_format=yuv420p min s=2304x1296 fps=2 max s=2304x1296 fps=2 [dshow @ 0000000002c457c0] pixel_format=yuv420p min s=2304x1536 fps=2 max s=2304x1536 fps=2 [dshow @ 0000000002c457c0] vcodec=mjpeg min s=640x480 fps=5 max s=640x480 fps=30 [dshow @ 0000000002c457c0] vcodec=mjpeg min s=160x90 fps=5 max s=160x90 fps=30 [dshow @ 0000000002c457c0] vcodec=mjpeg min s=160x120 fps=5 max s=160x120 fps=30 [dshow @ 0000000002c457c0] vcodec=mjpeg min s=176x144 fps=5 max s=176x144 fps=30 [dshow @ 0000000002c457c0] vcodec=mjpeg min s=320x180 fps=5 max s=320x180 fps=30 [dshow @ 0000000002c457c0] vcodec=mjpeg min s=320x240 fps=5 max s=320x240 fps=30 [dshow @ 0000000002c457c0] vcodec=mjpeg min s=352x288 fps=5 max s=352x288 fps=30 [dshow @ 0000000002c457c0] vcodec=mjpeg min s=432x240 fps=5 max s=432x240 fps=30 [dshow @ 0000000002c457c0] vcodec=mjpeg min s=640x360 fps=5 max s=640x360 fps=30 [dshow @ 0000000002c457c0] vcodec=mjpeg min s=800x448 fps=5 max s=800x448 fps=30 [dshow @ 0000000002c457c0] vcodec=mjpeg min s=800x600 fps=5 max s=800x600 fps=30 [dshow @ 0000000002c457c0] vcodec=mjpeg min s=864x480 fps=5 max s=864x480 fps=30 [dshow @ 0000000002c457c0] vcodec=mjpeg min s=960x720 fps=5 max s=960x720 fps=30 [dshow @ 0000000002c457c0] vcodec=mjpeg min s=1024x576 fps=5 max s=1024x576 fps=30 [dshow @ 0000000002c457c0] vcodec=mjpeg min s=1280x720 fps=5 max s=1280x720 fps=30 [dshow @ 0000000002c457c0] vcodec=mjpeg min s=1600x896 fps=5 max s=1600x896 fps=30 [dshow @ 0000000002c457c0] vcodec=mjpeg min s=1920x1080 fps=5 max s=1920x1080 fps=30 [dshow @ 0000000002c457c0] Pin "Capture" [dshow @ 0000000002c457c0] vcodec=h264 min s=640x480 fps=5 max s=640x480 fps=30 [dshow @ 0000000002c457c0] vcodec=h264 min s=160x90 fps=5 max s=160x90 fps=30 [dshow @ 0000000002c457c0] vcodec=h264 min s=160x120 fps=5 max s=160x120 fps=30 [dshow @ 0000000002c457c0] vcodec=h264 min s=176x144 fps=5 max s=176x144 fps=30 [dshow @ 0000000002c457c0] vcodec=h264 min s=320x180 fps=5 max s=320x180 fps=30 [dshow @ 0000000002c457c0] vcodec=h264 min s=320x240 fps=5 max s=320x240 fps=30 [dshow @ 0000000002c457c0] vcodec=h264 min s=352x288 fps=5 max s=352x288 fps=30 [dshow @ 0000000002c457c0] vcodec=h264 min s=432x240 fps=5 max s=432x240 fps=30 [dshow @ 0000000002c457c0] vcodec=h264 min s=640x360 fps=5 max s=640x360 fps=30 [dshow @ 0000000002c457c0] vcodec=h264 min s=800x448 fps=5 max s=800x448 fps=30 [dshow @ 0000000002c457c0] vcodec=h264 min s=800x600 fps=5 max s=800x600 fps=30 [dshow @ 0000000002c457c0] vcodec=h264 min s=864x480 fps=5 max s=864x480 fps=30 [dshow @ 0000000002c457c0] vcodec=h264 min s=960x720 fps=5 max s=960x720 fps=30 [dshow @ 0000000002c457c0] vcodec=h264 min s=1024x576 fps=5 max s=1024x576 fps=30 [dshow @ 0000000002c457c0] vcodec=h264 min s=1280x720 fps=5 max s=1280x720 fps=30 [dshow @ 0000000002c457c0] vcodec=h264 min s=1600x896 fps=5 max s=1600x896 fps=30 [dshow @ 0000000002c457c0] vcodec=h264 min s=1920x1080 fps=5 max s=1920x1080 fps=30 video=Logitech HD Pro Webcam C920: Immediate exit requested 
0
Zeigt `ffmpeg -list_options true -f dshow -i video =" Logitech HD Pro Webcam C920 "` zusätzliche Informationen über die Eingabe an? (Aber ich bin mir nicht sicher, ob es ein Windows-Benutzer ist). LordNeckbeard vor 7 Jahren 0
@LordNeckbeard Das tut es! Vielen Dank. Nun der knifflige Teil ... es gibt zwei Pins, die als "Capture" bezeichnet werden. Hast du eine Idee, wie ich welche Pin angeben kann, wenn es einen redundanten Namen gibt? Brad vor 7 Jahren 0
@LordNeckbeard `ffmpeg -f dshow -vcodec h264 -video_size 1920x1080 -framerate 30 -i video =" Die Logitech HD Pro Webcam C920 -vcodec copy test.mp4 "zeigt den Videostream korrekt als Eingabe und Ausgabe an, jedoch scheinen keine Frames zu laufen Die Kamera leuchtet wie die Aufnahme, aber FFmpeg sitzt nur bei Bild 0, Zeit 00: 00: 00.00, Bitrate = N / A. Wenn Sie es einige Minuten laufen lassen, scheint es nie zu beginnen. Irgendwelche Vorschläge? Brad vor 7 Jahren 0
Vielleicht `-video_pin_name 1`, um den zweiten sogenannten" Pin "auszuwählen. Nicht sicher, warum dieses Wort gewählt wurde ... Ich habe am Montag Zugriff auf einen Windows-Computer, wenn jemand anderes keine nützlichen Informationen anbietet. LordNeckbeard vor 7 Jahren 0

1 Antwort auf die Frage

0
ScottC

ffmpeg -s 1920x1080 -framerate 30 -rtbufsize 100MB -f dshow -vcodec h264 -i video = "Logitech HD Pro Webcam C920" -copyinkf -vcodec kopiert die DateiOut.mp4

Sie erhalten einen Full-HD-3-MBit / s-Videostream ohne erneute Kodierung von der Kamera auf die Festplatte. Ich habe keine Möglichkeit gefunden, eine andere Bitrate anzufordern. Beim Start gibt es eine Verzögerung von etwa 7 Sekunden. Ich glaube, dass die Verzögerung mit Keyframes zusammenhängt, aber ich konnte das nicht überprüfen oder die Verzögerung reduzieren. Wenn noch jemand helfen kann, bitte.

Ich benutze:

ffmpeg version N-80906-gd5edb6c Copyright (c) 2000-2016 der FFmpeg-Entwickler gebaut mit gcc 5.4.0 (GCC) Konfiguration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable -frei0r --enable-gnutls --enable-iconv --enable-libass - -enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore- amrnb --enable-libopencore-amrwb --enable-libop enjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab lenable- libvo-amrwbenc --enable-libvorbis --enable -libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable -zlib Libavutil 55. 28.100 / 55. 28.100 libavcodec 57. 48.101 / 57. 48.101 libavformat 57. 41.100 / 57. 41.100 libavdevice 57. 0.102 / 57. 0.102 libavfilter 6. 47.100 / 6. 47.100 libswscale 4. 1.100 / 4. 1.100 libswresample 2. 1.100 / 2. 1.100 libpostproc 54. 0,100 / 54 0,100 
Ich probiere es aus und bekomme: `[dshow @ 00000000006c2cc0] Videooptionen konnten nicht eingestellt werden und` Video = Logitech HD Pro Webcam C920: I / O-Fehler` Dzwiedziu-nkg vor 7 Jahren 0