Skip to content

CVBS Composite Decode

Harry Munday edited this page Jan 27, 2023 · 25 revisions

CVBS an abrevation,

Composite Video Baseband Signal. (also lesser used: colour, video, blanking, and sync)

Baseband means a de-modulated signal off a recorded medium or a non-modulated live signal directly off a camera or media generation device.

Baseband signals are ready for direct use for audio this means a speaker and for video used to be an analogue analogue CRT TV set now its all on analogue to digital converter ICs.

Composite analogue video signals have been used from the pre-digital era to early digital equipment, developed in the 1950s and in full use from the 1960s to even today analogue systems using the ''Yellow RCA jack'' on consumer equipment and a BNC jack on prosumer/broadcast equipment.

S-Video is just composite Lumanance with the Chromance modulated this minimizes colour interference during transport inside a cable with a pair of 2 shield cables shielded S-Video cable or 2 seprate BNC cables then the chroma is demodulated at the input device level, there are 3 versions of this standard.

CVBS Resolution Standards

720x576i PAL

720x480i NTSC

240p / 280p PAL/NTSC

900p CCTV (An non-standard use of the extra resolution area)

Capturing RAW CVBS

The DomesDayDuplicator's input filtering is not suited for said signal range, C401 Ideally needs to be modifyed but currently this does not work well either capturing the signal improperly.

CX Cards can try to switch back into standard mode causing wavy, jiggling, loss of vertical sync frames, if the card is in 8-bit or 16-bit modes and in a fixed low gain state (level 0 / sixdb off) it is possible to get clean stable captures.

There is also using a T adaptor to feed a secondary signal via waveform generator to keep CX Cards in raw output mode, then in post to low pass filter it and then decode it.

Installation

Install vhs-decode first.

Might need to do:

python3 setup.py build_ext --inplace

Thats it you are ready to use CVBS-Decode!

Usage

Currently, this decoder will work just fine with stable signals and live media.

Example Usage Command:

./cvbs-decode --debug --pal -A --cxadc composite-test.u8 composite-test

To stop the decode press Ctrl+C

Click the link for the full list, the below are just basic usage commands only.

Set Input Frequency

Just like vhs-decode & ld-decode the default is 40msps 8-bit/10-bit/16-bit input.

Captures can be FLAC compressed (.cvbs) or Uncompressed .u8/u16 etc

-f Frequency Adjust in integers of hz, mhz, ghz or 4fsc/5fsc/8fsc/10fsc

--cxadc 28.6 MHz/8-bit (8fsc) Stock Crystal Native 8xFsc 8bit Unsigned Sampling Mode

--cxadc3 35.8 MHz/8-bit (10fsc) Stock Crystal Native 4xFsc 16bit Filtered Vertical Blanking Interval Data

--10cxadc 14.3 MHz/16-bit (4fsc) Stock Crystal 1.25x 8xFsc 8bit Unsigned Sampling Mode

--10cxadc3 17.9 MHz/16-bit (5fsc) Stock Crystal 1.25x 4xFsc 16bit Filtered Vertical Blanking Interval Data

Set TV System

-n NTSC

--NTSCJ NTSC-J

-p PAL

--pm PAL-M

Decode Control

--debug Enables debug detailed logging output.

-A Automatic Sync Detection (Currently Mandatory)

-S Seek Frame of Capture

--right_hand_hsync Use right hand horisontal sync detection.

--ct Chroma Trap, cleans up chorma interferance on the luma channel.

--sl Defines sharpness by default this is set to 0. (0-100 Range)

--notch Define the centre frequency for the optional built-in notch "bandpass" filter.

--notch_q define Q factor Intended primarily for reducing noise from interference however, the decoder logic already compensates based on tape type and TV System values.

Time Base Corrected Output

The Composite signal is stored in a single .tbc

lossless digital version of the entire baseband composite signal like a D2/D3 digital tape.

Full 4fsc 1135x625 PAL (17727262 hz) (25i) (4.2GB/min) (560mbps)

Full 4fsc 910x525 NTSC (14318181 hz) (29.97i) (3.4GB/min) (453mbps)

Export to video file

CVBS-Decode is the same workflow as Laserdisc (without audio) using the suite of ld-tools.

The chroma-decoder can use over 20GB of ram if avalible.

ld-chroma-decoder is used to render the TBC to a full colour video file you can render to y4m or pip to ffmpeg to make a FFV1 or V210 file.

Replace INPUT.tbc and OUTPUT.mkv with your desired names.

Export to video 4:2:2 PAL

ld-chroma-decoder -f pal2d -p y4m -q INPUT.tbc| ffmpeg -i - -c:v ffv1 -level 3 -coder 1 -context 1 -g 60 -slicecrc 1 -color_primaries bt470bg -color_trc gamma28 -colorspace bt470bg -color_range tv -pix_fmt yuv422p10 OUTPUT.mkv

Export to video 4:2:2 NTSC

ld-chroma-decoder -f ntsc3d -p y4m -q INPUT.tbc| ffmpeg -i - -c:v ffv1 -level 3 -coder 1 -context 1 -g 60 -slicecrc 1 -color_primaries smpte170m -color_trc smpte170m -colorspace smpte170m -color_range tv -pix_fmt yuv422p10 OUTPUT.mkv

Remux to V210 (Interlaced)

ffmpeg -i -c:v v210 -f mov -top 1 -vf setfield=tff -flags +ilme+ildct -metadata:s:v:0 “encoder=Uncompressed 10-bit 4:2:2” -movflags write_colr" -pix_fmt yuv422p10le -c:a s24le output.mov

Remux to V210 (Passthough)

ffmpeg -i -c:v v210 -f mov -metadata:s:v:0 “encoder=Uncompressed 10-bit 4:2:2” -movflags write_colr" -pix_fmt yuv422p10le -c:a s24le output.mov
Clone this wiki locally