https://github.com/oyvindln/vhs-decode Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code + Explore + All features + Documentation + GitHub Skills + Blog * Solutions + For + Enterprise + Teams + Startups + Education + By Solution + CI/CD & Automation + DevOps + DevSecOps + Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles + Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} oyvindln / vhs-decode Public forked from happycube/ld-decode * Notifications * Fork 48 * Star 227 Software defined VHS decoder - Fork (maybe temporary) of the ld-decode Laserdisc rf decoder License GPL-3.0 license 227 stars 48 forks Star Notifications * Code * Issues 27 * Pull requests 1 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights oyvindln/vhs-decode This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. vhs_decode Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 6 branches 20 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/o] Use Git or checkout with SVN using the web URL. [gh repo clone oyvind] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. This branch is 408 commits ahead, 2 commits behind happycube:master. Latest commit @harrypm harrypm Fix broken links. ... 962df79 Dec 6, 2022 Fix broken links. Fixed broken VBI data-related links, and fixed command examples. 962df79 Git stats * 3,745 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github/workflows Merge branch 'master' of https://github.com/happycube/ld-decode into ... Oct 10, 2022 assets/images Readme Overhual Part 1. May 24, 2022 cmake_modules chroma-encoder: Add BT.601 YCbCr input support Nov 15, 2022 cvbsdecode Fix cvbs-decode to work with upstream changes Dec 5, 2022 docs Sync fixes, chroma refactor and AFC (PLL alike) experimental -cafc fl... Jul 23, 2021 lddecode Merge branch 'master' of https://github.com/happycube/ld-decode into ... Dec 5, 2022 notebooks Add a PAL dev notebook as an example Nov 19, 2022 scripts chroma-encoder: Add BT.601 YCbCr input support Nov 15, 2022 tools Merge branch 'master' of https://github.com/happycube/ld-decode into ... Nov 30, 2022 vhs_scripts Fix shell scripts as recommended by shellcheck (#58) Sep 17, 2022 vhsdecode fix breakage due to upstream change Dec 5, 2022 .flake8 Fix flake warnings and run formatter Jan 27, 2021 .gitignore More Qt Creator things ignored Sep 8, 2022 CMakeLists.txt Patches for macOS 13 (Ventura) Nov 22, 2022 LICENSE make ld-decode GPL3 Aug 17, 2019 README.md Fix broken links. Dec 6, 2022 README_ld.md Updated readme (#29) May 15, 2021 advanced_flags.md Updated readme (#29) May 15, 2021 cvbs-decode cvbs-decode minor fixes: Nov 3, 2022 cx-expander prelim tuning for new levels Apr 18, 2022 gen_chroma_vid.sh Check if audio file exists and abort if it doesn't (#65) Nov 20, 2022 gen_chroma_vid_ntsc.sh fix chroma gain value in old scripts Oct 9, 2022 gen_chroma_vid_pal.sh fix chroma gain value in old scripts Oct 9, 2022 gen_chroma_vid_palm.sh fix chroma gain value in old scripts Oct 9, 2022 ld-cut Add ld-cut to github tests (fix happycube#679) Jan 20, 2022 ld-decode first pass at an --AC3 option, works on test.ldf Nov 3, 2022 ld-ldf-reader.c Fix some compiler warnings (happycube#734) Jun 4, 2022 pyproject.toml Fix values in pyproject.toml for pypi Sep 10, 2022 requirements.txt The packages needed to make devbook-base.ipynb work on a clean venv May 16, 2022 setup.cfg add pyproject stuff for making python builds and more vhsdecode scrip... Aug 29, 2022 setup.py Merge branch 'master' of https://github.com/happycube/ld-decode into ... Oct 10, 2022 tests.py fix tests Aug 4, 2022 vhs-decode Move vhs-decode script code to module, add separate script for callin... Dec 11, 2021 vhs-decode-gui Refactor lineloc stuff a little, look at end of hsync to refine linelocs Jan 4, 2022 View code [ ] VHS-Decode (It does more than VHS now!) Supported Tape Formats FAQ - Frequently Asked Questions CVBS-Decode HiFi-Decode Dependencies - Hardware A Tape Player (VCR/VTR etc) RF Capture Devices Domesday Duplicator (DdD) (Method 01 - 300-350USD*) CX Card & CXADC (Method 02 - 20-35USD) Deployment of Capture Hardware Dependencies & Installation - Software Installation and running the software on Ubuntu/Debian Usage ld-tools suite for Windows (Note this is only the tools, not the decoder's) CX Card Setup & Capture Decoding Compression and Decompression Generating Colour Video Files (.TBC to Playable .MKV) To generate an video output with the Top VBI area included use the following command: Terminal Arguments Please Check the Wiki for the complete and upto-date command list! CXADC Specific Sample Rate Commands: Manual Configuration Commands Colour System Commands Time & Location Control Time Base Correction & Visuals Control Input file formats: Output file formats: Join us More Documentation If in doubt - Feel free to read the docs/wiki again if its not there then ask! README.md vhs-decode logo VHS-Decode (It does more than VHS now!) A fork of LD-Decode, the decoding software powering the Domesday86 Project. This version has been modified to work with the differences found in the tracked RF drum head signals taken directly from videotapes. (Not to be confused with the TV Modulator/Demodulator pack or the "antenna connectors" on the back of the VCR!). [DdD-EBU-Co] SMPTE ColourBars (16:9) Test Tape With WSS (PAL) export exported full-frame (1112 x 624) Supported Tape Formats (S-)VHS 625-line and 525-line - NTSC, NTSC-J, PAL and PAL-M Fully Supported U-Matic 625-line and 525-line Low Band, PAL and NTSC. - Fully Supported Betamax 625-line and 525-line, PAL & NTSC - Working Video8 & High8 625-line and 525-line, PAL & NTSC - Working FAQ - Frequently Asked Questions CVBS-Decode The repository also contains an experimental CVBS decoder, cvbs-decode, which shares code with ld-decode and vhs-decode. Capable of decoding basic raw digitized NTSC and PAL composite video, including colour if the source is somewhat stable. Samples can be captured using cxadc, however, this is somewhat buggy as the cx chip can decide to resample or do other things if it detects a valid video signal if the gain is too high. Test samples & signals can be generated using HackTV Note for test media generation AJA/Magewell/Blackmagic and even some consumer digital to analogue converters have test generators built-in some prosumer/broadcast decks also have generators built in same for later camcorders. HiFi-Decode Functional but still a work in progress is VideoMem's HiFi-Decode Branch witch takes uncompressed or flac compressed RF captures of HiFi audio, decodes and outputs standard 24bit 192khz FLAC or PCM (.wav) stereo files. Dependencies - Hardware A Tape Player (VCR/VTR etc) Preferably adjusted per tape and in excellent mechanical and head condition, prosumer metal track decks are preferable as they were built generally better in terms of mechnical stability than cheaper later consumer decks that use more plastics, the only crtical requirement is test points or a head amplifyer that is easy to tap into this goes for any and all tape formats. Note SVHS tapes can be RF captured on standard VHS HiFi decks. Note SVHS NTSC Decks - Currently inflated you can import PAL decks with NTSC support for 1/3rd the price though this only applys if conventinal refrance SVHS captures are required. Its good practice to not cross contaminate tapes especially if dealing with mouldy or contained tapes always clean your tape track/ drum/heads before and afterwards with with 99.9% Isopropanol and lint free cloths/pads/paper this ensures less dropouts from dirty heads. It also helps to make sure to re-lubricate metal and plastic moving joints cogs and bearings with appropriate grease's and oils to avoid mechnincal failures. RF Capture Devices Domesday Duplicator (DdD) (Method 01 - 300-350USD*) Capture is done using an simple GUI application. Linux Application Windows Application Originally geared towards capturing RF from laserdiscs players, it does however also work perfectly well for digitizing Tape RF data. It consists of a custom analogue to digital board with an amplifier, an off-shelf DE0-NANO FPGA development board, and a Cypress FX3 SuperSpeed Explorer USB 3.0 board. How To Aquire? / How to Fabricate & Flash? / More Information CX Card & CXADC (Method 02 - 20-35USD) Capture & Config uses simple command-line arguments and parameters CXADC There is now an CXADC Wiki explaining best card types and guides for modifications such as crystal upgrades. The budget approach is using a video capture card based on a Conexant CX23880/1/2/3 PCI chipset. With a modified Linux driver, these cards can be forced to output RAW data that can be captured to file, instead of decoding video normally as they otherwise would. There are now ''New'' Chinese variants that can be found on AliExpress that have integrated Asmedia or ITE 1x PCIE bridge chips allowing modern systems to use them. The cards sadly however at stock without any modifications these have more self-noise compared to the DdD with about a 3db signal to noise difference, Currently, the CX23883-39 based white variant cards in recent testing have been consistently lower noise. Deployment of Capture Hardware Please Read the VHS-Decode Wiki for more in-depth information as it has examples locations and setup photos for various decks that have been RF tap'ed and tested. If there is no info on your VCR in the wiki then acquire the service manual for your device, Google it! (But they are nearly all labelled clearly, so are not hard to visually identify and if serviced commonly marked with a sharpie) 1. Find your test points test points will be called one of the following if looking though a service manual or labels on the VCR boards: Modulated Video: RF C, RF Y+C, PB, V RF, V ENV, ENV, ENVELOPE, VIDEO ENVE, VIDEO ENVELOPE (Normally accompanied by a Composite test point useful if your VCR only has a SCART connection you can add another BNC for video) HiFi Audio: RF-Out, A-RF, HIFI RF 2. Decide on connection method, Soldered or Clipped/Clamped. (Soldered is recommended due to reliability) For some Sony decks you can use Dupont connectors on the pins to save effort soldering or hooking an probe. For alligator clips this is red signal black ground if you have bigger test points like on Rackmount and later prosumer decks. For direct soldering RG178 or RG316 cable to an BNC bulk head is recommended this allows a short clean direct run to a fixed mounting point you can drill or melt/file out or just thread the cable though a ventilation slit and so on. 3. Test to see if an 10uf capacitor is needed, If you want to see your tape during RF capture or are playing SVHS or other higher bandwidth tapes you will need to add one in-line before your bulkhead/probe connection to avoid signal dropout. (Applies to most VCRs but not all) Note Do not make sharp bends in any RF cabling. Note with Coax cable (RGxxx etc) the centre stranded wire is signal and outer shield wire is ground twist the ground strands tight to make a solder able connection, and use ample flux to flow solder correctly, then wipe with 99.9% IPA to clean the flux off. Note Some UMATIC decks have a direct RF output on the back that may be viable for RF capture. (needs expanding on) Dependencies & Installation - Software VHS-Decode, as with LD-Decode, has been developed and tested on machines running the latest version of Ubuntu and Linux Mint. Other distributions might have outdated (or even newer) versions of certain Python libraries or other dependencies, breaking compatibility. Its fully working on WSL2 Ubuntu 20.04 (Windows Subsystem for Linux) however issues with larger captures i.g 180gb+ may require expanding the default virtual disk size It also partially runs on Windows natively; currently, ld-tools have been ported over. Other dependencies include Python 3.5+, numpy, scipy, cython, numba, pandas, Qt5, Cmake, and FFmpeg. Some useful free tools to note for post processing are StaxRip & Lossless Cut & of course DaVinci Resolve this gives you basic editing to quickly handle uncompressed files cross operating systems, and for windows users an easy FFMPEG/AviSynth/Vapoursynth encoding and de-interlacing experience, and full colour grading and post production ability. Installation and running the software on Ubuntu/Debian By default, the main VHS-Decode script allocates only one thread, though the gen_chroma_vid scripts allocate two threads. The make rule of thumb of "number of logical processors, plus one" generally applies here, though it mainly depends on the amount of memory available to the decoder. Install all dependencies required by LD-Decode and VHS-Decode: sudo apt install clang libfann-dev python3-setuptools python3-numpy python3-scipy python3-matplotlib git qt5-default libqwt-qt5-dev libfftw3-dev python3-tk python3-pandas python3-numba libavformat-dev libavcodec-dev libavutil-dev ffmpeg openssl pv python3-distutils make cython3 cmake For Ubuntu 22.04 that is: sudo apt install clang libfann-dev python3-setuptools python3-numpy python3-scipy python3-matplotlib git qt5-qmake qtbase5-dev libqwt-qt5-dev libfftw3-dev python3-tk python3-pandas python3-numba libavformat-dev libavcodec-dev libavutil-dev ffmpeg openssl pv python3-distutils pkg-config make cython3 cmake Install dependencies for GPU FLAC compression support: sudo apt install make ocl-icd-opencl-dev mono-runtime Install all dependencies required for optional gooey graphical user interface: sudo apt-get install build-essential dpkg-dev freeglut3-dev libgl1-mesa-dev libglu1-mesa-dev libgstreamer-plugins-base1.0-dev libgtk-3-dev libjpeg-dev libnotify-dev libpng-dev libsdl2-dev libsm-dev libtiff-dev libwebkit2gtk-4.0-dev libxtst-dev python3.9-dev libpython3.9-dev Then install gooey pip3 install Gooey Download VHS-Decode: git clone https://github.com/oyvindln/vhs-decode.git vhs-decode Install VHS-Decode: cd vhs-decode sudo ./setup.py install Compile and Install ld-tools suite: (Required) mkdir build cd build cmake .. make -j4 sudo make install To update do git pull while inside of the vhs-decode directory. Usage Note with WSL2 & Ubuntu, ./ in front of applications and scripts may be needed to run them. Use cd vhs-decode to enter into the directory to run commands, cd.. to go back a directory. ld-tools suite for Windows (Note this is only the tools, not the decoder's) The ld-tools suit has been ported to windows, This mainly allows the easy use of LD-Analyse to view .TBC files, please see the wiki for more information Windows Tools Builds CX Card Setup & Capture See the readme file for CXADC for more information on how to configure the driver and what each mode and capture rate means. To see a live preview of tape signal being received by CXADC card from video head tracked signal will be unstable or wobbly if settings are not the same you may only see signal flash if in 16-bit modes for example, this is quite useful if you don't own an CRT with H/V shifting as it will allow you to inspect the full area for alignment/ tracking issues. PAL framing for 35.8 MHz/8-bit mode: ffplay -hide_banner -async 1 -f rawvideo -pix_fmt gray8 -video_size 2291x625 -i /dev/cxadc0 -vf scale=1135x625,eq=gamma=0.5:contrast=1.5 NTSC framing for 35.8 MHz/8-bit mode: ffplay -hide_banner -async 1 -f rawvideo -pix_fmt gray8 -video_size 2275x525 -i /dev/cxadc0 -vf scale=910x525,eq=gamma=0.5:contrast=1.5 Capture 30 seconds of tape signal using CXADC driver 8-bit samples timeout 30s cat /dev/cxadc0 > .u8 For 16-bit Simply change the end extension to .u16 & for flac captures re-name the end to your desired tape format like .VHS etc It is recommended to use fast storage of 40MB/s+ write ability to avoid dropped samples. Decoding To use VHS Decode GUI Run: ./vhs-decode-gui Decode your captured tape to a .tbc by using: vhs-decode [arguments] Use analyse tool to inspect decoded tape: ld-analyse .tbc Compression and Decompression For DomesDayDuplicator Captures simply run ld-compress Your .lds file will be compressed to an FLAC OGG .ldf file For CXADC and other 8/16bit captures use the following: Editable flags are The --bps flag can be changed to --bps=8 or --bps=16 for 8 & 16 bit captures. Change to your input file name. Reduce size of captured CXADC data (by 40-60%): flac --best --sample-rate=48000 --sign=unsigned --channels=1 --endian=little --bps=8 --ogg -f .u8 Decompress FLAC compressed captures. flac -d --force-raw-format --sign=unsigned --endian=little .vhs .u16 Output will be filename.ogg so rename the end extension to .vhs / .hifi etc. Generating Colour Video Files (.TBC to Playable .MKV) VHS-Decode produces two timebase corrected 16-bit headerless files separated into chroma/luma video signals in the .tbc format plus .json and .log files, usable with the LD-Decode family of tools ld-analyse, ld-process-vbi, ld-process-vits and ld-dropout-correct. But also notably VBI (Vertical Blanking Interval) data recovery software can be used like and for the following: VHS-Teletext (European Subtitles) FFMPEG EIA-608 (North America Closed Captioning) FFMEPG Read VITC Timecode (Standard SMPTE Timecode) Tape-based Arcade Games! To generate an video output with the Top VBI area included use the following command: PAL: ./gen_chroma_vid.sh --ffll 2 --lfll 308 --ffrl 2 --lfrl 620 .tbc NTSC: ./gen_chroma_vid.sh --ffll 2 --lfll 308 --ffrl 2 --lfrl 520 .tbc Please Check the Wiki for the complete upto-date command list! gen_chroma_vid.sh now automatically detects PAL/NTSC based on the .JSON legacy scripts still exsist ./gen_chroma_vid.sh -h (Lists Command Options) ./gen_chroma_vid.sh Input-TBC-Name (Will just export the video with standard settings and the same input file name) To generate .mkv files viewable in most media players, simply use the scripts installed: Command Examples: ./gen_chroma_vid.sh -v -s -l -i <.tbc filename without .tbc extension> The -a option can embed an audio file, such as audio decoded via HiFi Decode ./gen_chroma_vid.sh -v -s -l -a .flac -i <.tbc filename without .tbc extension> So for example open terminal in the directory of target TBC/Metadata files and run ./gen_chroma_vid.sh -v -s -l -a .flac -i <.tbc filename without .tbc extension> This will use decoded .tbc files, generate a lossless, interlaced and high-bitrate (roughly 70-100 Mb/s) FFV1 codec video which, although ideal for archival and reducing further loss in quality however this may be unsuitable for sharing online without de-interlacing. An additional processing mode is included in the script files, but commented out. Terminal Arguments Please Check the Wiki for the complete and upto-date command list! VHS-Decode supports various arguments to process differently captured tape recordings and different tape formats/systems. These tend to change frequently as new features are added or superseded. The below commands changes the sample rate and bit depth for the decoder. By default, this is set to 40 MHz (the sample rate used by the Domesday Duplicator) at 16 bits. CXADC Specific Sample Rate Commands: --cxadc 28.6 MHz/8-bit (8fsc) --cxadc3 35.8 MHz/8-bit (10fsc) --10cxadc 14.3 MHz/16-bit (4fsc) --10cxadc3 17.9 MHz/16-bit (5fsc) Manual Configuration Commands -f Adjusts sampling frequency in integer units. Example's -f 280000hz or -f 28mhz or -f 8fsc -tf Sets Tape Format enter VHS, SVHS, UMATIC, BETAMAX, VIDEO8, HI8 (Default is VHS) Colour System Commands Changes the colour or TV system to NTSC, PAL, PAL-M, NTSC-J, or MESECAM respectively. Please note that, as of writing, support for PAL-M is experimental. -n = NTSC -p = PAL --pm = PAL-M --NTSCJ = NTSC-J --MESECAM = MESECAM Time & Location Control These commands are used for jumping ahead in a file or defining limits. Useful for recovering decoding after a crash, or by limiting process time by producing shorter samples. -s Jumps ahead to any given frame in the capture. --start_fileloc Jumps ahead to any given sample in the capture. -l Limits decode length to n frames. -t Defines the number of processing threads to use during demodulation. (note: upon crashing, vhs-decode automatically dumps the last known sample location in the terminal output) Time Base Correction & Visuals Control --debug sets logger verbosity level to debug. Useful for debugging and better log information. (Recommended To Enable for Archival) --ct enables a chroma trap, a filter intended to reduce chroma interference on the main luma signal. Use if seeing banding or checkerboarding on the main luma .tbc in ld-analyse. --recheck_phase Re-check chroma phase on every field, fixes most colour issues. (No effect on U-matic) --sl defines the output sharpness level, as an integer from 0-100, the default being 0. Higher values are better suited for plain, flat images i.e. cartoons and animated material, as strong ghosting can occur (akin to cranking up the sharpness on any regular TV set.) --dp demodblock Displays Raw Demodulated Frequency Spectrum Graphs, makes a pop-up window per each thread so -t 32 would give you 32 GUI windows etc Input file formats: .ldf/.lds (Domesday Duplicator FLAC-compressed and uncompressed data). .r8/.u8 (CXADC 8-bit raw data). .r16/.u16 (CXADC 16-bit raw data). .flac/.cvbs/.vhs/.svhs/.betacam/.betamax/.video8/.hi8 (FLAC-compressed captures, can be either 8-bit or 16-bit). Output file formats: Unlike LD-Decode, VHS-Decode does not output its timebase-corrected frames as a single .tbc file. Both the luminance and chrominance channels are separate data files essentially an digital "S-Video", additionally useful for troubleshooting descriptor/log files are generated so you end up with 4 files in the following naming. filename.tbc - Luminance Image Data filename_chroma.tbc - Chrominance Image Data filename.tbc.json - Frame Descriptor Table (Resolution/Dropouts/SNR/ Frames/VBI Timecode) filename.log - Timecode Indexed Action/Output Log Join us Discord Facebook VideoHelp Forum More Documentation VHS-Decode Wiki Google Doc Documentation If in doubt - Feel free to read the docs/wiki again if its not there then ask! About Software defined VHS decoder - Fork (maybe temporary) of the ld-decode Laserdisc rf decoder Resources Readme License GPL-3.0 license Stars 227 stars Watchers 19 watching Forks 48 forks Releases 20 tags Packages 0 No packages published Languages * Jupyter Notebook 67.7% * C++ 22.1% * Python 9.0% * Shell 0.5% * C 0.3% * Cython 0.2% * CMake 0.2% Footer (c) 2022 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.