[FFmpeg-user] Hauppauge WinTV-7164 Analog Composite/S-Video Capture

Roger rogerx.oss at gmail.com
Wed May 4 07:44:55 EEST 2022


Figured it out finally.

The Hauppauge 2250 (SAA7164 chip), has two tuners, each with dvb/analog 
TV/composite/svideo inputs.  The exact inputs need to be specied, else without 
specifying, using ffmpeg on simply "Hauppauge WinTV-7164 Analog Capture" will 
produce random results with inputs, including the audio input.

I'm focused on capturing the raw audio and video streams provided by the 
Hauppauge 2250 PCIe card's MS Windows proprietary SAA7164 chip driver.  Using 
Linux open source SAA7164 driver, or using MS Windows' Hauppauge WinTV, users 
will only be able to record the already compressed transport and progressive 
MPEG2 combined audio/video streams.

For me and many power users, we want the raw stream, or the yuyv422 rawvideo 
and s16 PCM audio.  Still, both streams will be already combined by the 
Hauppauge card.

c:\ ffmpeg -f dshow -list_options true -i video="Hauppauge WinTV-7164 Analog 
Capture"
ffmpeg version 5.0.1-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
[dshow @ 000002229f7a5100] DirectShow video device options (from video devices)                                                                                                                    
[dshow @ 000002229f7a5100]  Pin "~Capture" (alternative pin name "0")                                                                                                                              
[dshow @ 000002229f7a5100]   pixel_format=yuyv422  min s=720x576 fps=25 max s=720x576 fps=29.97                                                                                                    
[dshow @ 000002229f7a5100]   pixel_format=yuyv422  min s=720x480 fps=25 max s=720x480 fps=29.97                                                                                                    
[dshow @ 000002229f7a5100]   pixel_format=yuyv422  min s=640x480 fps=25 max s=640x480 fps=29.97                                                                                                    
[dshow @ 000002229f7a5100]   pixel_format=yuyv422  min s=352x288 fps=25 max s=352x288 fps=29.97                                                                                                    
[dshow @ 000002229f7a5100]   pixel_format=yuyv422  min s=352x240 fps=25 max s=352x240 fps=29.97                                                                                                    
[dshow @ 000002229f7a5100]   pixel_format=yuyv422  min s=720x352 fps=25 max s=720x352 fps=29.97                                                                                                    
[dshow @ 000002229f7a5100]   pixel_format=yuyv422  min s=704x576 fps=25 max s=704x576 fps=29.97                                                                                                    
[dshow @ 000002229f7a5100]   pixel_format=yuyv422  min s=704x480 fps=25 max s=704x480 fps=29.97                                                                                                    
[dshow @ 000002229f7a5100]   pixel_format=yuyv422  min s=704x512 fps=25 max s=704x512 fps=29.97                                                                                                    
[dshow @ 000002229f7a5100]   pixel_format=yuyv422  min s=624x256 fps=25 max s=624x256 fps=29.97                                                                                                    
[dshow @ 000002229f7a5100]   pixel_format=yuyv422  min s=624x240 fps=25 max s=624x240 fps=29.97                                                                                                    
[dshow @ 000002229f7a5100]   pixel_format=yuyv422  min s=544x480 fps=25 max s=544x480 fps=29.97                                                                                                    
[dshow @ 000002229f7a5100]   pixel_format=yuyv422  min s=544x384 fps=25 max s=544x384 fps=29.97                                                                                                    
[dshow @ 000002229f7a5100]   pixel_format=yuyv422  min s=352x256 fps=25 max s=352x256 fps=29.97                                                                                                    
[dshow @ 000002229f7a5100]  Pin "~Audio" (alternative pin name "1")                                                                                                                                
[dshow @ 000002229f7a5100]  Pin "I2S Audio" (alternative pin name "3")                                                                                                                             
[dshow @ 000002229f7a5100] Crossbar Switching Information for Hauppauge WinTV-7164 Analog Capture:                                                                                                 
[dshow @ 000002229f7a5100]   Crossbar Output pin 0: "Video Decoder" related output pin: 1 current input pin: 2 compatible input                                                                    
pins: 0 2 3 4 6 7 8                                                                                                                                                                                
[dshow @ 000002229f7a5100]   Crossbar Output pin 1: "Audio Decoder" related output pin: 0 current input pin: -1 compatible input                                                                   
 pins: 1 5 9                                                                                                                                                                                       
[dshow @ 000002229f7a5100]   Crossbar Input pin 0 - "Video Tuner" related input pin: 1                                                                                                             
[dshow @ 000002229f7a5100]   Crossbar Input pin 1 - "Audio Tuner" related input pin: 0                                                                                                             
[dshow @ 000002229f7a5100]   Crossbar Input pin 2 - "Video Composite" related input pin: 5                                                                                                         
[dshow @ 000002229f7a5100]   Crossbar Input pin 3 - "S-Video" related input pin: 5
[dshow @ 000002229f7a5100]   Crossbar Input pin 4 - "Video AUX" related input pin: 5
[dshow @ 000002229f7a5100]   Crossbar Input pin 5 - "Audio Line" related input pin: 4
[dshow @ 000002229f7a5100]   Crossbar Input pin 6 - "Video Composite" related input pin: 9
[dshow @ 000002229f7a5100]   Crossbar Input pin 7 - "S-Video" related input pin: 9
[dshow @ 000002229f7a5100]   Crossbar Input pin 8 - "Video AUX" related input pin: 9
[dshow @ 000002229f7a5100]   Crossbar Input pin 9 - "Audio Line" related input pin: 8
video=Hauppauge WinTV-7164 Analog Capture: Immediate exit requested

Taking a closer look at the "Crossbar" titled inputs.  For me, only these 
specified working pin numbers for the Hauppauge 2250 card.

So, assuming ffmpeg uses the first tuner on the dual tuner card (eg. 
-video_device_number=0), the following provides both audio/video raw streams:

c:\ ffmpeg -f dshow -crossbar_audio_input_pin_number 5 -crossbar_video_input_pin_number 2 -i video="Hauppauge WinTV-7164 Analog Capture":audio="Hauppauge WinTV-7164 Analog Capture" -c copy test.yuv

Now I should be seeing within the captured raw file, stream of:
stream #0: pixel_format=yuyv422 s=720x480 fps=29.97
stream #1 s16 48000hz pcm 2 ch 1536 kb/s(?)

Currently, I'm getting some flaky results with an unplayable file using ffplay, etc.

However, directly encoding the file to a compressed format provides a playable 
file.  So I'm likely still doing something incorrect, and seemingly ffmpeg is 
being far less forgiving with my incanatations on Windows versus Linux.  With 
using ffmpeg on Linux, I rarely get unplayable rawvideo files, if ever.

TIP: For those using Windows, use/install Cygwin rather than using the Windows 
terminal.  Bash shell will be far easier to work with it's history and syntax.

BUG: The device specific URLS provided by ffmpeg dshow "-list_devices" for this 
Hauppauge provided some extremely length device URLs that were apparently not 
recognized by the dshow video= and audio= options.


Reference:
FFmpeg Devices Documentation - dshow
https://ffmpeg.org/ffmpeg-devices.html#dshow



> On Tue, May 03, 2022 at 01:43:29PM -0400, Roger wrote:
>
>I've found, after searching Google, the following on Linux pulls the entire 
>video+audio stream successfully:
>
>$ cat /dev/video0 | ffplay -
>
>or,
>
>$ ffmpeg -i file:/dev/video0
>
>Now to see if doing so within Windows does the same, likely omitting the "-f 
>dshow", similar to omitting the "-f v4l2" on Linux.
>
>
>
>
>----- Forwarded message from Roger <rogerx.oss at gmail.com> -----
>
>Subject: Hauppauge WinTV-7164 Analog Composite/S-Video Capture
>Date: Sat, 30 Apr 2022 14:50:31 -0400
>From: Roger <rogerx.oss at gmail.com>
>To: ffmpeg-user at ffmpeg.org
>
>Seems I'm plagued by the same bug as described here:
>https://stackoverflow.com/questions/19113197/ffmpeg-directshow-capture-2-pins
>
>
>Hauppauge WinTV-7164 Analog Composite/S-Video Capture
>Using this device trying to capture composite/s-video from VCR/VHS media.
>
>dshow device: "Hauppauge WinTV-7164 Analog Capture"
>
>(NTSC Model 2250)
>
>
>This Hauppauge PCIe device, likely many Hauppuage video capture cards,
>capture a video stream already combined with an audio stream.  The bug
>and fix posted to stackoverflow is similar.
>
>When specifying the following, either with/without ~Audio (pin 1), I
>do get an audio stream detected, but the audio stream is null/silent:
>
>D:\record-ffmpeg>ffplay -f dshow -rtbufsize 500M -video_size 720x480
>-framerate 29.97 -audio_pin_name ~Audio -show_video_device_dialog
>false -i video="Hauppauge WinTV-7164 Analog Capture":audio="Hauppauge
>WinTV-7164 Analog Capture"
>
>D:\record-ffmpeg>ffplay -f dshow -video_size 352x288 -i
>video="Hauppauge WinTV-7164 Analog Capture":audio="Hauppauge
>WinTV-7164 Analog Capture"
>ffplay version 5.0.1-full_build-www.gyan.dev Copyright (c) 2003-2022
>the FFmpeg developers
>  built with gcc 11.2.0 (Rev7, Built by MSYS2 project)
>  configuration: --enable-gpl --enable-version3 --enable-static
>--disable-w32threads --disable-autodetect --enable-fontconfig
>--enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp
>--enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib
>--enable-librist --enable-libsrt --enable-libssh --enable-libzmq
>--enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2
>--enable-libdav1d --enable-libdavs2 --enable-libuavs3d
>--enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp
>--enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid
>--enable-libaom --enable-libopenjpeg --enable-libvpx
>--enable-mediafoundation --enable-libass --enable-frei0r
>--enable-libfreetype --enable-libfribidi --enable-liblensfun
>--enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf
>--enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec
>--enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx
>--enable-libshaderc --enable-vulkan --enable-libplacebo
>--enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug
>--enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame
>--enable-libshine --enable-libtheora --enable-libtwolame
>--enable-libvo-amrwbenc --enable-libilbc --enable-libgsm
>--enable-libopencore-amrnb --enable-libopus --enable-libspeex
>--enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite
>--enable-libmysofa --enable-librubberband --enable-libsoxr
>--enable-chromaprint
>  libavutil      57. 17.100 / 57. 17.100
>  libavcodec     59. 18.100 / 59. 18.100
>  libavformat    59. 16.100 / 59. 16.100
>  libavdevice    59.  4.100 / 59.  4.100
>  libavfilter     8. 24.100 /  8. 24.100
>  libswscale      6.  4.100 /  6.  4.100
>  libswresample   4.  3.100 /  4.  3.100
>  libpostproc    56.  3.100 / 56.  3.100
>[dshow @ 0000020e9bb04f00] Could not find audio only device with name
>[Hauppauge WinTV-7164 Analog Capture] among source devices of type
>audio.
>[dshow @ 0000020e9bb04f00] Searching for audio device within video
>devices for Hauppauge WinTV-7164 Analog Capture
>Input #0, dshow, from 'video=Hauppauge WinTV-7164 Analog
>Capture:audio=Hauppauge WinTV-7164 Analog Capture':
>  Duration: N/A, start: 3738.527811, bitrate: 1536 kb/s
>  Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 352x288,
>29.97 fps, 29.97 tbr, 10000k tbn
>  Stream #0:1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
>3740.13 A-V: -0.010 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0
>
>D:\record-ffmpeg>
>
>
>It's possible the fix was, possibly a hack/workaround, specifically
>applied only for certain devices such as "AJA Capture Source".  Many
>Hauppauge capture cards should be added as well.
>
>Sometimes right after booting into Windows 10, I may get ffplay to
>play audio only with a blue screen.  Subsequent ffplay executions drop
>audio, with a blue screen, until either Hauppauge's WinTV10 or
>VirtualDub64 are subsequently executed, likely properly initializing
>the video capture card.  Subsequent ffplay executions show video
>properly but again without audio, only stating the video/audio stream
>specifications.  Nor is the audio stream recorded to file using
>ffmpeg.
>
>----- End forwarded message -----


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20220504/f2d455dd/attachment.sig>


More information about the ffmpeg-user mailing list