使用ffmpeg+directshow采集USB采集卡视频的规格内异常问题
Let's break down your issue first: your LogiLink VG0001a reports support for 720x576@25fps in both YUYV422 and YUV420p, but capturing at this resolution fails with buffer errors—even when copying raw streams or using VLC. This is a super common limitation with budget USB 2.0 capture cards: while the driver advertises the resolution, the hardware often can't sustain the required bandwidth or sync properly for PAL 576p, especially when paired with audio capture.
Here are targeted fixes to try, ordered by likelihood of success:
1. Force DirectShow Crossbar & PAL Format Lock
From your device's crossbar info, the video input is currently tied to "Video Composite" (pin 0), but 720x576 is a PAL-standard resolution. We need to explicitly tell DirectShow to use PAL format and lock the correct input pin to avoid sync issues:
ffmpeg -f dshow -input_format pal -crossbar_video_input_pin_number 0 -pixel_format yuyv422 -video_size 720x576 -framerate 25 -i video="USB2.0 Grabber":audio="Digital Audio Interface (USB Audio Interface)" -c:v libx264 -crf 18 -aspect 4:3 -vf "yadif=1" -pix_fmt yuv420p -c:a aac -b:a 392k capture.mp4
-input_format pal: Forces the capture card to switch to PAL mode, which matches the 720x576 resolution.-crossbar_video_input_pin_number 0: Locks the video input to composite (swap to1if you're using S-Video).
2. Tune Buffer Sizes & Process Priority
You tried increasing rtbufsize, but sometimes oversized buffers cause the card to drop frames instead. Try a smaller, targeted buffer size plus queue adjustments and higher process priority:
ffmpeg -f dshow -input_format pal -pixel_format yuyv422 -video_size 720x576 -framerate 25 -rtbufsize 10M -thread_queue_size 512 -i video="USB2.0 Grabber":audio="Digital Audio Interface (USB Audio Interface)" -c:v libx264 -crf 18 -aspect 4:3 -vf "yadif=1" -pix_fmt yuv420p -c:a aac -b:a 392k -priority high capture.mp4
-rtbufsize 10M: Keeps the buffer small enough to avoid lag but large enough to handle minor signal drops.-thread_queue_size 512: Prevents audio/video queue overflow by adjusting the buffer limits for each stream.-priority high: Ensures FFmpeg gets first dibs on system resources, reducing frame drops from background processes.
3. Capture Raw First, Encode Later
If real-time encoding is causing bandwidth bottlenecks, skip the live encode and save the raw stream first, then process it post-capture:
# Step 1: Capture raw uncompressed video + audio ffmpeg -f dshow -input_format pal -pixel_format yuyv422 -video_size 720x576 -framerate 25 -i video="USB2.0 Grabber":audio="Digital Audio Interface (USB Audio Interface)" -c:v copy -c:a pcm_s16le raw_capture.avi # Step 2: Encode the raw file to MP4 ffmpeg -i raw_capture.avi -c:v libx264 -crf 18 -aspect 4:3 -vf "yadif=1" -pix_fmt yuv420p -c:a aac -b:a 392k final_capture.mp4
By copying the raw stream (-c:v copy), you eliminate the CPU load of real-time encoding, letting the capture card push data to disk without bottlenecks. The post-processing step can then handle the encoding without time pressure.
4. Check Hardware & Signal Basics
Don't overlook the physical layer—bad connections or mismatched settings often cause these issues:
- Verify your VHS player is set to PAL output (720x576 is PAL; NTSC uses 720x480). A mismatched format will cause the capture card to fail to sync video frames.
- Plug the capture card directly into a USB 3.0 port (even though it's USB 2.0, USB 3.0 ports provide more stable power and bandwidth than older USB 2.0 ports). Avoid USB hubs—they can introduce latency or bandwidth throttling.
- Replace your video cable (composite or S-Video). Frayed or low-quality cables can cause signal degradation that makes the card unable to parse 720x576 frames correctly.
Final Note
If none of these fixes work, it's almost certainly a hardware limitation of the LogiLink VG0001a. Budget USB 2.0 capture cards often advertise resolutions they can't actually handle in practice—720x576@25fps YUYV422 requires ~20MB/s of bandwidth, which is right at the limit of USB 2.0. Adding audio capture pushes it over the edge, leading to buffer overflow and dropped video frames. In that case, you'll either need to drop to a lower resolution (like 352x288) or upgrade to a USB 3.0 capture card with better bandwidth handling.
内容的提问来源于stack exchange,提问作者leoncvlt

