Logo

dev-resources.site

for different kinds of informations.

Access webcam by ffmpeg in Windows

Published at
3/3/2024
Categories
ffmpeg
Author
saladlam
Categories
1 categories in total
ffmpeg
open
Author
8 person written this
saladlam
open
Access webcam by ffmpeg in Windows

In Windows, access multimedia devices such as webcam is through the DirectShow library.

Display available devices

ffmpeg -hide_banner -f dshow -list_devices true -i dummy
[dshow @ 000001ff6c6f1540] "Logi C615 HD WebCam" (video)
[dshow @ 000001ff6c6f1540]   Alternative name "@device_pnp_\\?\usb#vid_046d&pid_082c&mi_02#7&67fa7ba&0&0002#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global"
[dshow @ 000001ff6c6f1540] "Intel Virtual Camera" (video)
[dshow @ 000001ff6c6f1540]   Alternative name "@device_sw_{860BB310-5D01-11D0-BD3B-00A0C911CE86}\{49C7D45E-2F4B-40FF-BEF7-A7D95B2CD31D}"
[dshow @ 000001ff6c6f1540] "Microphone (Logi C615 HD WebCam)" (audio)
[dshow @ 000001ff6c6f1540]   Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{C332401D-216A-4F5F-8354-B5A0FAEC6C35}"
[in#0 @ 000001ff6c6adc00] Error opening input: Immediate exit requested
Error opening input file dummy.
Enter fullscreen mode Exit fullscreen mode

Display capacity of a video device

ffmpeg -hide_banner -f dshow -list_options true -i video="Logi C615 HD WebCam"
[dshow @ 000001ee64890200] DirectShow video device options (from video devices)
[dshow @ 000001ee64890200]  Pin "Capture" (alternative pin name "0")
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=640x480 fps=5 max s=640x480 fps=30
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=640x480 fps=5 max s=640x480 fps=30 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=160x120 fps=5 max s=160x120 fps=30
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=160x120 fps=5 max s=160x120 fps=30 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=176x144 fps=5 max s=176x144 fps=30
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=176x144 fps=5 max s=176x144 fps=30 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=320x240 fps=5 max s=320x240 fps=30
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=320x240 fps=5 max s=320x240 fps=30 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=432x240 fps=5 max s=432x240 fps=30
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=432x240 fps=5 max s=432x240 fps=30 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=352x288 fps=5 max s=352x288 fps=30
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=352x288 fps=5 max s=352x288 fps=30 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=640x360 fps=5 max s=640x360 fps=30
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=640x360 fps=5 max s=640x360 fps=30 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=800x448 fps=5 max s=800x448 fps=30
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=800x448 fps=5 max s=800x448 fps=30 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=864x480 fps=5 max s=864x480 fps=24
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=864x480 fps=5 max s=864x480 fps=24 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=1024x576 fps=5 max s=1024x576 fps=15
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=1024x576 fps=5 max s=1024x576 fps=15 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=800x600 fps=5 max s=800x600 fps=24
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=800x600 fps=5 max s=800x600 fps=24 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=960x720 fps=5 max s=960x720 fps=15
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=960x720 fps=5 max s=960x720 fps=15 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=1280x720 fps=5 max s=1280x720 fps=10
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=1280x720 fps=5 max s=1280x720 fps=10 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=1600x896 fps=5 max s=1600x896 fps=7.5
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=1600x896 fps=5 max s=1600x896 fps=7.5 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=1920x1080 fps=5 max s=1920x1080 fps=5
[dshow @ 000001ee64890200]   pixel_format=yuyv422  min s=1920x1080 fps=5 max s=1920x1080 fps=5 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=640x480 fps=5 max s=640x480 fps=30
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=640x480 fps=5 max s=640x480 fps=30 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=160x120 fps=5 max s=160x120 fps=30
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=160x120 fps=5 max s=160x120 fps=30 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=176x144 fps=5 max s=176x144 fps=30
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=176x144 fps=5 max s=176x144 fps=30 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=320x240 fps=5 max s=320x240 fps=30
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=320x240 fps=5 max s=320x240 fps=30 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=432x240 fps=5 max s=432x240 fps=30
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=432x240 fps=5 max s=432x240 fps=30 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=352x288 fps=5 max s=352x288 fps=30
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=352x288 fps=5 max s=352x288 fps=30 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=640x360 fps=5 max s=640x360 fps=30
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=640x360 fps=5 max s=640x360 fps=30 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=800x448 fps=5 max s=800x448 fps=30
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=800x448 fps=5 max s=800x448 fps=30 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=864x480 fps=5 max s=864x480 fps=30
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=864x480 fps=5 max s=864x480 fps=30 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=1024x576 fps=5 max s=1024x576 fps=30
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=1024x576 fps=5 max s=1024x576 fps=30 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=800x600 fps=5 max s=800x600 fps=30
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=800x600 fps=5 max s=800x600 fps=30 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=960x720 fps=5 max s=960x720 fps=30
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=960x720 fps=5 max s=960x720 fps=30 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=1280x720 fps=5 max s=1280x720 fps=30
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=1280x720 fps=5 max s=1280x720 fps=30 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=1600x896 fps=5 max s=1600x896 fps=30
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=1600x896 fps=5 max s=1600x896 fps=30 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=1920x1080 fps=5 max s=1920x1080 fps=30
[dshow @ 000001ee64890200]   vcodec=mjpeg  min s=1920x1080 fps=5 max s=1920x1080 fps=30 (pc, bt470bg/bt709/unknown, center)
[in#0 @ 000001ee64854500] Error opening input: Immediate exit requested
Error opening input file video=Logi C615 HD WebCam.
Enter fullscreen mode Exit fullscreen mode

Display capacity of a audio device

ffmpeg -hide_banner -f dshow -list_options true -i audio="Microphone (Logi C615 HD WebCam)"
[dshow @ 0000017b378e2140] DirectShow audio only device options (from audio devices)
[dshow @ 0000017b378e2140]  Pin "Capture" (alternative pin name "Capture")
[dshow @ 0000017b378e2140]   ch= 2, bits=16, rate= 44100
    Last message repeated 1 times
[dshow @ 0000017b378e2140]   ch= 1, bits=16, rate= 44100
[dshow @ 0000017b378e2140]   ch= 2, bits=16, rate= 32000
[dshow @ 0000017b378e2140]   ch= 1, bits=16, rate= 32000
[dshow @ 0000017b378e2140]   ch= 2, bits=16, rate= 22050
[dshow @ 0000017b378e2140]   ch= 1, bits=16, rate= 22050
[dshow @ 0000017b378e2140]   ch= 2, bits=16, rate= 11025
[dshow @ 0000017b378e2140]   ch= 1, bits=16, rate= 11025
[dshow @ 0000017b378e2140]   ch= 2, bits=16, rate=  8000
[dshow @ 0000017b378e2140]   ch= 1, bits=16, rate=  8000
[dshow @ 0000017b378e2140]   ch= 2, bits= 8, rate= 44100
[dshow @ 0000017b378e2140]   ch= 1, bits= 8, rate= 44100
[dshow @ 0000017b378e2140]   ch= 2, bits= 8, rate= 22050
[dshow @ 0000017b378e2140]   ch= 1, bits= 8, rate= 22050
[dshow @ 0000017b378e2140]   ch= 2, bits= 8, rate= 11025
[dshow @ 0000017b378e2140]   ch= 1, bits= 8, rate= 11025
[dshow @ 0000017b378e2140]   ch= 2, bits= 8, rate=  8000
[dshow @ 0000017b378e2140]   ch= 1, bits= 8, rate=  8000
[dshow @ 0000017b378e2140]   ch= 2, bits=16, rate= 48000
[dshow @ 0000017b378e2140]   ch= 1, bits=16, rate= 48000
[dshow @ 0000017b378e2140]   ch= 2, bits=16, rate= 96000
[dshow @ 0000017b378e2140]   ch= 1, bits=16, rate= 96000
[in#0 @ 0000017b3789bac0] Error opening input: Immediate exit requested
Error opening input file audio=Microphone (Logi C615 HD WebCam).
Enter fullscreen mode Exit fullscreen mode

create a avi video from webcam's mjpeg source, without reencode, and stop recording after 30s

ffmpeg -hide_banner -f dshow -t 30 -vcodec mjpeg -video_size 1920x1080 -framerate 30 -i video="Logi C615 HD WebCam" -vcodec copy output.avi
[mjpeg @ 0000024aec2e57c0] unable to decode APP fields: Invalid data found when processing input
Input #0, dshow, from 'video=Logi C615 HD WebCam':
  Duration: N/A, start: 253712.074389, bitrate: N/A
  Stream #0:0: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/bt709/unknown), 1920x1080, 30 fps, 30 tbr, 10000k tbn
Output #0, avi, to 'output.avi':
  Metadata:
    ISFT            : Lavf60.16.100
  Stream #0:0: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/bt709/unknown), 1920x1080, q=2-31, 30 fps, 30 tbr, 60 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[out#0/avi @ 0000024aec55df00] video:160382kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.029904%
size=  160430kB time=00:00:29.93 bitrate=43901.2kbits/s speed=0.998x
Enter fullscreen mode Exit fullscreen mode
ffmpeg Article's
30 articles in total
Favicon
Desvendando Subprocessos: Criando um Bot de Música com Go
Favicon
Video data IO through ffmpeg subprocess
Favicon
Wisper, ffmpeg을 활용한 비디오 자막 자동 생성
Favicon
Integrating MinIO notifications with your Node.js service, FFmpeg, and Mozilla convert API.
Favicon
Cliet-side WebM/MP4 export from React.js Canavs Animation using ffmpeg.wasm for an Upwork client
Favicon
Reduce bitrate using FFMPEG
Favicon
Add a Watermark to a Video Using VideoAlchemy
Favicon
No Bullshit Guide to Youtube shorts automation in NodeJS, OpenAI, Ollama, ElevanLabs & ffmpeg
Favicon
Building a Video Streaming Platform with Node.js, FFmpeg, and Next.js
Favicon
Record Windows Screen using ffmpeg and convert to time lapse video
Favicon
Introducing Comet: A Free, Cross-Platform Video Converter Powered by FFmpeg
Favicon
Compress, Convert and Trim Videos with Command Line
Favicon
เผื่อใครอยากทำ mp4 to gif แบบคมๆ
Favicon
How to generate thumbnails from video ?
Favicon
Convert .caf to mp3 by Directory
Favicon
FFMPEG
Favicon
Run ffmpeg within a Docker Container: A Step-by-Step Guide
Favicon
New to DEV.to - About me
Favicon
Streaming Video to AWS MediaConnect Using FFmpeg and SRT Protocol: A Complete Guide
Favicon
Displaying a video on a ESP32 powered SSD1306 OLED screen
Favicon
FFMPEG Libraries - RTSP Client Keep Alive
Favicon
From Pixels to Playbacks: Dominate Multimedia with FFmpeg in Python
Favicon
Access webcam by ffmpeg in Windows
Favicon
OSCAR 2022 sea surface velocity streamplot animation
Favicon
Mastering Video Previews: A Guide to Compressed Videos and Thumbnails
Favicon
Dall.E Image Gen, And Size Comparison Of Image Formats
Favicon
AIS vessel density maps with pyspark and h3 and animations with ffmpeg
Favicon
Using Electron to create videos (Canvas + FFmpeg)
Favicon
BMF 📹 + Hugging Face🤗, The New Video Processing BFFs
Favicon
Leveraging GPU Acceleration in BMF for High-Performance Video Processing

Featured ones: