-
Notifications
You must be signed in to change notification settings - Fork 40
CVBS Composite Decode
This spin-off project uses RAW CVBS captures and uses the signal processing and time base correction code, from vhs-decode & ld-decode there is no de-modulation like FM media.
CVBS an abbreviation,
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 Luminance 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 separate BNC cables then the chroma is demodulated at the input device level, there are 3 versions of this standard.
Signal Format | Resolution | Field System | TV System | Aspect Ratio | RF Capture Support | Decoding Support |
---|---|---|---|---|---|---|
CVBS | 525 Lines | Interlaced | 525 NTSC | 4:3 / 16:9 | Yes* | Yes* |
CVBS | 625 Lines | Interlaced | 625 PAL | 4:3 / 16:9 | Yes* | Yes* |
CVBS 240p | 240 Lines | Progressive | NTSC | 4:3 / 16:9 | Yes* | Yes* |
CVBS 288p | 288 Lines | Progressive | PAL | 4:3 / 16:9 | Yes* | Yes* |
960h CCTV | 960 x 576 | Interlaced | N/A | 16:9 Only | Yes* | Not Tested |
CX Cards can try to switch back into standard mode causing wavy, jiggling, and loss of vertical sync frames, however if the card is in a fixed low gain state (level 0 / sixdb off) it is possible to get clean stable captures.
The DomesDayDuplicator's input filtering is not suited for said signal range, the input filtering stage needs to be modified currently, this does not work well as it captures the signal improperly.
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.
cvbs-decode
is inside the vhs-decode install.
However you might need to do:
python3 setup.py build_ext --inplace
That's it you are ready to use CVBS-Decode!
Currently, this decoder will work just fine with stable signals and live media.
-A
is mandatory for CVBS-Decode to work.
Example Usage Command:
./cvbs-decode --debug --pal -A --cxadc composite-test_28msps_8-bit.u8 composite-test
To stop the decode press Ctrl+C
Export to Video File
The TBC-Video-Export tool will automatically detect NTSC/PAL input, run ld-dropout correct, and ld-process-vbi and embed the updated .json file inside the mkv, and export a FFV1 10-bit 4:2:2 interlaced file, read the wiki doc for detailed use of its profiles.
Linux & MacOS:
python3 tbc-video-export.py composite-test.tbc
Windows:
tbc-video-export.exe composite-test.tbc
cvbs-decode outputs 3 files
filename.tbc
- Luminance & Chrominance Image Data
filename.tbc.json
- Frame Descriptor Table (Resolution/Dropouts/SNR/Frames/VBI Data)
filename.log
- Timecode Indexed Action/Output Log
ld-analyse composite-test.tbc
Click the link for the full list, the below are just basic usage commands only.
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 (Not Recommeded for capture due to up-sampling)
--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
-n
NTSC
--NTSCJ
NTSC-J
-p
PAL
--pm
PAL-M
--debug
Enables debug detailed logging output.
-A
Automatic Sync Detection (Currently Mandatory For CVBS-Decode to work)
-S
Seek Frame of Capture
--right_hand_hsync
Use right-hand horizontal sync detection.
--ct
Chroma Trap, cleans up chroma interference 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
defines the Q factor Intended primarily for reducing noise from interference however, the decoder logic already compensates based on tape type and TV System values.
The Composite signal is stored in a single .tbc
This is a lossless digital file 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)
-
Chroma issues with NTSC VHS use
ntsc-phase-comp
with chroma-decoder. -
CVBS-Decode is not like ld-decode or vhs-decode so unstable sources will most likely require tinkering.
-
Limited capture hardware (although this is being worked on)
CVBS-Decode is the same workflow as Laserdisc's in with LD-Decode (without audio etc) using the suite of ld-tools.
ld-chroma-decoder
is used to render the TBC to a full-colour video file you can render to y4m or pipe to FFmpeg.
The chroma-decoder can use over 20~35GB of ram if available and can run faster then real-time on fairly modern systems.
The decoder has lots of options that can be tweaked but the list of pre-made commands below will get you started with a good basic export with proper interlaced flagging.
Use ld-chroma-decoder -h
to list all the options available to the decoder.
Replace INPUT.tbc
and OUTPUT.mkv
with your desired names.
For standard output this list of export commands is provided you only need to change setdar=4/3
to setdar=16/9
for widescreen content.
Y4M Only* you can use these 2 commands. (Will be resolved with tbc-video-export later)
NTSC
ld-chroma-decoder --ffll 1 --lfll 259 --ffrl 2 --lfrl 525 --decoder ntsc3d -p y4m -q INPUT.tbc OUTPUT.mov
PAL
ld-chroma-decoder --ffll 2 --lfll 308 --ffrl 2 --lfrl 620 --decoder transform3d -p y4m -q INPUT.tbc OUTPUT.mov
NTSC
ld-chroma-decoder --decoder ntsc3d -p y4m -q INPUT.tbc| ffmpeg -i - -c:v ffv1 -level 3 -coder 1 -context 1 -g 1 -slicecrc 1 -vf setfield=tff -flags +ilme+ildct -color_primaries smpte170m -color_trc bt709 -colorspace smpte170m -color_range tv -pix_fmt yuv422p10le -vf setdar=4/3,setfield=tff OUTPUT.mkv
PAL
ld-chroma-decoder --decoder transform3d -p y4m -q INPUT.tbc| ffmpeg -i - -c:v ffv1 -level 3 -coder 1 -context 1 -g 1 -slicecrc 1 -vf setfield=tff -flags +ilme+ildct -color_primaries bt470bg -color_trc bt709 -colorspace bt470bg -color_range tv -pix_fmt yuv422p10le -vf setdar=4/3,setfield=tff OUTPUT.mkv
NTSC
ld-chroma-decoder --decoder ntsc3d -p y4m -q INPUT.tbc| ffmpeg -i - -c:v v210 -f mov -top 1 -vf setfield=tff -flags +ilme+ildct -pix_fmt yuv422p10le -color_primaries smpte170m -color_trc bt709 -colorspace smpte170m -color_range tv -vf setdar=4/3,setfield=tff OUTPUT.mov
PAL
ld-chroma-decoder --decoder transform3d -p y4m -q INPUT.tbc| ffmpeg -i - -c:v v210 -f mov -top 1 -vf setfield=tff -flags +ilme+ildct -pix_fmt yuv422p10le -color_primaries bt470bg -color_trc bt709 -colorspace bt470bg -color_range tv -vf setdar=4/3,setfield=tff OUTPUT.mov
NTSC
ld-chroma-decoder --decoder ntsc3d -p y4m -q INPUT.tbc| ffmpeg -i - -c:v prores -profile:v 3 -vendor apl0 -bits_per_mb 8000 -quant_mat hq -f mov -top 1 -vf setfield=tff -flags +ilme+ildct -pix_fmt yuv422p10le -color_primaries smpte170m -color_trc bt709 -colorspace smpte170m -color_range tv -vf setdar=4/3,setfield=tff OUTPUT.mov
PAL
ld-chroma-decoder --decoder transform3d -p y4m -q INPUT.tbc| ffmpeg -i - -c:v prores -profile:v 3 -vendor apl0 -bits_per_mb 8000 -quant_mat hq -f mov -top 1 -vf setfield=tff -flags +ilme+ildct -pix_fmt yuv422p10le -color_primaries bt470bg -color_trc bt709 -colorspace bt470bg -color_range tv -vf setdar=4/3,setfield=tff OUTPUT.mov
NTSC
ld-chroma-decoder --decoder ntsc3d -p y4m -q INPUT.tbc OUTPUT.mov
PAL
ld-chroma-decoder --decoder transform3d -p y4m -q INPUT.tbc OUTPUT.mov
NTSC
ld-chroma-decoder --decoder ntsc3d -p y4m -q INPUT.tbc| ffmpeg -i - -c:v v410 -f mov -top 1 -vf setfield=tff -flags +ilme+ildct -pix_fmt yuv444p10le -color_primaries smpte170m -color_trc bt709 -colorspace smpte170m -color_range tv -vf setdar=4/3,setfield=tff OUTPUT.mov
PAL
ld-chroma-decoder --decoder transform3d -p y4m -q INPUT.tbc| ffmpeg -i - -c:v v410 -f mov -top 1 -vf setfield=tff -flags +ilme+ildct -pix_fmt yuv444p10le -color_primaries bt470bg -color_trc bt709 -colorspace bt470bg -color_range tv -vf setdar=4/3,setfield=tff OUTPUT.mov
NTSC
ld-chroma-decoder --decoder ntsc3d -p y4m -q INPUT.tbc| ffmpeg -i - -c:v prores -profile:v 5 -vendor apl0 -bits_per_mb 8000 -mbs_per_slice -f mov -top 1 -vf setfield=tff -flags +ilme+ildct -pix_fmt yuv444p10le -color_primaries smpte170m -color_trc bt709 -colorspace smpte170m -color_range tv -vf setdar=4/3,setfield=tff OUTPUT.mov
PAL
ld-chroma-decoder --decoder transform3d -p y4m -q INPUT.tbc| ffmpeg -i - -c:v prores -profile:v 5 -vendor apl0 -bits_per_mb 8000 -mbs_per_slice 8 -f mov -top 1 -vf setfield=tff -flags +ilme+ildct -pix_fmt yuv444p10le -color_primaries bt470bg -color_trc bt709 -colorspace bt470bg -color_range tv -vf setdar=4/3,setfield=tff OUTPUT.mov
- FAQ - Frequently Asked Questions
- Diagram Breakdowns
- Visual-Comparisons
- VCR Reports / RF Tap Examples
- Download & Contribute Data
- Speed Testing
- Visual VBI Data Guide
- Closed Captioning
- Teletext
- WSS Wide - Screen Signalling
- VITC Timecode
- VITS Signals
- XDS Data (PBS)
- Video ID IEC 61880
- Vapoursynth TBC Median Stacking Guide
- Ruxpin-Decode & TV Teddy Tapes
- Tony's GNU Radio For Dummies Guide
- Tony's GNU Radio Scripts
- DomesDay Duplicator Utilities
- ld-decode Utilities