Giter Site home page Giter Site logo

esp32-analog-video-over-wifi's Introduction

Analog Composite Video Transmission over Wi-Fi for ESP32

Goals

  • Transmit a NTSC signal captured by a CCTV camera over Wi-Fi to a central monitoring server
  • Reduce bandwidth for transmission, as a raw BT.601/BT.656 stream requires a bandwidth of 216Mbps, which is unacceptable even over LAN
  • Minimize costs per converter/transmitter

Equipment

  • Any NTSC composite camera - in my case, I have a handful of Bosch VDC-455V04-20 CCTV cameras
  • NTSC-M digital video decoder - whatever the cheapest you can find on eBay, e.g.
    • TW9900
    • AK8859VN
    • GM7150BC
  • ESP32 module with >=1MB pSRAM - ESP32's SRAM is not big enough to store even a single frame
  • Various power supplies and/or voltage regulators required to power the decoder/ESP32
  • Additional components as required by the decoder/ESP32

Video Decoder Requirements

  • Compliant BT.601 output
  • Has I²C interface (AKA two wire serial interface)
  • Can output synced, hsync, vsync signals
  • Ability to remove hsync/vsync, SAV/EAV signals from transmission

Interface Pinout

+-----------+
|       AIN | <---- () Analog NTSC composite video
|           |
|           |       +---------------+
|      SCLK | <---- | I2C_SCL       |
|      SDAT | <---> | I2C_SDA       |
|           |       |               |
|      DCLK | ----> | I2S0I_WS_in   |
| SYNC (EN) | ----> | I2S0_H_ENABLE |
|     HSYNC | ----> | I2S0_H_SYNC   |
|     VSYNC | ----> | I2S0_V_SYNC   |
| DATA[7:0] | ----> | I2S0I_Data_in |
+-----------+       +---------------+

Order of Operations

  1. Set up logging
  2. Set up Wi-Fi
  3. Set up I²S transfer
    • This includes allocating enough DMA RAM for one line of data
    • Invert HSYNC/VSYNC/enable signals in software if necessary
  4. Allocate enough RAM on pSRAM for one complete frame
  5. Set up decoder
  6. Wait until client has connected
  7. Start decoder
  8. Wait until signal is syncronized so data transfer can begin
  9. When HSYNC is active:
    • Copy the line data to pSRAM, swapping BT.601's CbY0CrY1 data order to the JPEG library's Y0CbY1Cr expected input
    • Remember that since the signal is interlaced, copy into rows 1, 3, 5, ..., and then to rows 2, 4, 6, ...
    • In the event this copying takes longer than HSYNC, allocate a second DMA RAM chunk for the next line
  10. When VSYNC is reached, repeat step 7, but prepare to copy field 2 (even rows)
  11. On the next VSYNC:
    • Call the JPEG library to convert the resulting YUV frame to JPEG
    • Transfer result, along with headers, over Wi-Fi
    • If this takes longer than the VBLANK period, offload these tasks to the second core.
    • If the conversion is not done before end of VBLANK period, create another buffer for the frame on pSRAM
  12. Go to step 8, waiting until VBLANK is done

esp32-analog-video-over-wifi's People

Contributors

wooky avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.