Traffic Cam → YouTube Streamer

Rotate government traffic cameras on your YouTube live stream — HCMC & NYC

New York City 316 cameras works worldwide

Download NYC Script

Source: 511ny.org public API / NYS DOT — HLS streams, no auth, accessible from anywhere

Ho Chi Minh City 69 cameras Vietnam network only

Download HCMC Script HCMC Setup Script

Source: giaothong.hochiminhcity.gov.vn — requires Vietnam VPS or VPN

Quick start (NYC — works right now):
curl -fsSL GRIDWORK_URL/nyc_stream_rotator.sh -o nyc.sh && chmod +x nyc.sh && ./nyc.sh YOUR_YT_KEY

What This Is

Bash scripts that pull live HLS video streams from government traffic camera systems and broadcast them to your YouTube live stream, automatically rotating between cameras.

CityCamerasSourceAccess
New York City316 (1,541 statewide)511ny.org public API / NYS DOTWorldwide — no auth
Ho Chi Minh City69giaothong.hochiminhcity.gov.vnVietnam network only

NYC — New York City (works everywhere)

How It Works

The 511NY system provides a free, public REST API at https://511ny.org/api/getcameras?format=json that returns all 2,921 cameras statewide. Each active camera has a VideoUrl field containing a direct HLS .m3u8 stream URL hosted on nysdot.skyvdn.com.

No auth, no API key, no geo-restriction. These are public government streams accessible from anywhere in the world.

Quick Start

# 1. Install ffmpeg (if needed)
sudo apt install -y ffmpeg

# 2. Download
curl -fsSL GRIDWORK_URL/nyc_stream_rotator.sh -o nyc.sh && chmod +x nyc.sh

# 3. Stream to YouTube (rotates every 2 min)
./nyc.sh YOUR_YOUTUBE_STREAM_KEY

# 4. Or rotate every 5 minutes, in background
nohup ./nyc.sh YOUR_KEY 300 > nyc.log 2>&1 &

Test a stream right now

# Should output "h264,352,240" — it's alive!
ffprobe -v error -show_entries stream=codec_name,width,height -of csv=p=0 \
  "https://s9.nysdot.skyvdn.com:443/rtplive/R11_271/playlist.m3u8"

API: Refresh Camera List

# Get all active NYC cameras with stream URLs
curl -s "https://511ny.org/api/getcameras?format=json" | \
  python3 -c "
import sys, json
data = json.load(sys.stdin)
nyc = [c for c in data
       if c.get('VideoUrl') and not c.get('Disabled')
       and 40.49 <= c.get('Latitude',0) <= 40.92
       and -74.27 <= c.get('Longitude',0) <= -73.68]
for c in nyc:
    print(f'{c[\"Name\"]}|{c[\"VideoUrl\"]}')
"

NYC Camera Picks (30 of 316)

#CameraAreaStream URL
1West St @ West Houston StManhattanhttps://s9.nysdot.skyvdn.com:443/rtplive/R11_271/playlist.m3u8
2West St @ W 34 StManhattanhttps://s9.nysdot.skyvdn.com:443/rtplive/R11_272/playlist.m3u8
3West St @ W 57 StManhattanhttps://s9.nysdot.skyvdn.com:443/rtplive/R11_273/playlist.m3u8
4Harlem River Dr @ 127 StManhattanhttps://s7.nysdot.skyvdn.com:443/rtplive/R11_153/playlist.m3u8
5Harlem River Dr @ 135 StManhattanhttps://s9.nysdot.skyvdn.com:443/rtplive/R11_251/playlist.m3u8
6Henry Hudson Pkwy @ W 66 StManhattanhttps://s9.nysdot.skyvdn.com:443/rtplive/R11_242/playlist.m3u8
7Henry Hudson Pkwy @ W 119 StManhattanhttps://s9.nysdot.skyvdn.com:443/rtplive/R11_260/playlist.m3u8
8Henry Hudson Pkwy @ La SalleManhattanhttps://s7.nysdot.skyvdn.com:443/rtplive/R11_258/playlist.m3u8
9I-495 Queens Midtown TunnelTunnelhttps://s51.nysdot.skyvdn.com:443/rtplive/R11_127/playlist.m3u8
10I-87 @ Macombs Dam BridgeBridgehttps://s52.nysdot.skyvdn.com:443/rtplive/R11_044/playlist.m3u8
11I-87 Gov Cuomo BridgeBridgehttps://s53.nysdot.skyvdn.com:443/rtplive/TA_028/playlist.m3u8
12I-678 Van Wyck @ North ConduitQueens/JFKhttps://s7.nysdot.skyvdn.com:443/rtplive/R11_157/playlist.m3u8
13I-678 Van Wyck @ LIEQueenshttps://s7.nysdot.skyvdn.com:443/rtplive/R11_183/playlist.m3u8
14I-678 Van Wyck @ Northern BlvdQueenshttps://s7.nysdot.skyvdn.com:443/rtplive/R11_186/playlist.m3u8
15I-678 Whitestone @ 14th AveQueenshttps://s7.nysdot.skyvdn.com:443/rtplive/R11_188/playlist.m3u8
16I-495 LIE @ 220th StQueenshttps://s7.nysdot.skyvdn.com:443/rtplive/R11_154/playlist.m3u8
17I-95 Bruckner @ Buhre AveBronxhttps://s52.nysdot.skyvdn.com:443/rtplive/R11_012/playlist.m3u8
18I-95 @ Hutchinson River PkwyBronxhttps://s53.nysdot.skyvdn.com:443/rtplive/TA_051/playlist.m3u8
19I-278 @ Richmond AveStaten Islandhttps://s7.nysdot.skyvdn.com:443/rtplive/R11_211/playlist.m3u8
20I-278 @ Victory BlvdStaten Islandhttps://s7.nysdot.skyvdn.com:443/rtplive/R11_213/playlist.m3u8
21Korean War Vets Pkwy @ TyrellanStaten Islandhttps://s7.nysdot.skyvdn.com:443/rtplive/R11_189/playlist.m3u8
22I-87 @ ArdsleyWestchesterhttps://s53.nysdot.skyvdn.com:443/rtplive/TA_021/playlist.m3u8
23I-87 @ Saw Mill River PkwyWestchesterhttps://s53.nysdot.skyvdn.com:443/rtplive/TA_022/playlist.m3u8
24I-95 @ New RochelleWestchesterhttps://s53.nysdot.skyvdn.com:443/rtplive/TA_052/playlist.m3u8
25I-87 Gov Cuomo Bridge 2Westchesterhttps://s53.nysdot.skyvdn.com:443/rtplive/TA_030/playlist.m3u8

Full list of 316 NYC cameras available via the API above.


HCMC — Ho Chi Minh City (Vietnam network)

How It Was Built

1. Discovered the API

The HCMC government traffic site at giaothong.hochiminhcity.gov.vn/Map.aspx is an ExtJS app. By inspecting its JavaScript (/public/global.js), we found:

2. Called the API

The API requires a session cookie from visiting Map.aspx, then accepts POST requests:

# Step 1: Get session cookie
curl -sk -c cookies.txt "https://giaothong.hochiminhcity.gov.vn/Map.aspx"

# Step 2: Query cameras with VideoStreaming enabled
curl -sk -b cookies.txt \
  -X POST \
  -H "X-AjaxPro-Method: SearchQuery" \
  -d '{
    "path": "/root/vdms/tangthu/data/layerdata/camera",
    "isInTree": false,
    "searchKey": "",
    "layer": ["CAMERA"],
    "detail": true,
    "page": 1,
    "limit": 100,
    "filterQuery": ["Publish:true", "VideoStreaming:1"],
    "sortby": null,
    "returnFields": ["CamId","DisplayName","VideoUrl",
                     "VideoStreaming","Disctrict","CamStatus"]
  }' \
  "https://giaothong.hochiminhcity.gov.vn/ajaxpro/\
VDMS.Web.Library.AJAX.FolderAjax,VDMS.Web.Library.ashx"

3. Extracted 69 Stream URLs

Two types of stream endpoints were found:

TypePatternCount
VOV CDNhttp://camera.thongtingiaothong.vn/s/{id}/index.m3u8~35
Direct HLShttp://125.234.114.126:11984/api/stream.m3u8?src={name}~34

4. Built the Rotator

The script uses ffmpeg to pull each HLS stream, re-encode to H264 1080p, overlay the camera name, and push to YouTube via RTMP.


Setup on a Vietnamese Machine

Important: The camera streams are hosted on Vietnamese government servers (125.234.x.x, camera.thongtingiaothong.vn). They are only reachable from Vietnam or nearby Asian networks. You need a VPS in Vietnam or a VPN with a Vietnam exit node.

Option A: One-Line Auto Setup

curl -fsSL GRIDWORK_URL/setup_vietnam.sh | bash

Then run:

./hcmc_stream_rotator.sh YOUR_YOUTUBE_STREAM_KEY

Option B: Manual Step-by-Step

Step 1: Install dependencies

sudo apt update && sudo apt install -y ffmpeg curl

Step 2: Download the script

curl -fsSL GRIDWORK_URL/hcmc_stream_rotator.sh -o hcmc_stream_rotator.sh
chmod +x hcmc_stream_rotator.sh

Step 3: Test a camera stream

# Should output "hls" if reachable
ffprobe -v error -show_entries format=format_name -of csv=p=0 \
  "http://camera.thongtingiaothong.vn/s/56de42f611f398ec0c481287/index.m3u8"

Step 4: Get your YouTube stream key

  1. Go to YouTube Studio
  2. Click "Go Live" or "Create" → "Go Live"
  3. Under "Stream" tab, copy the "Stream key"

Step 5: Start streaming

# Rotate cameras every 2 minutes (default)
./hcmc_stream_rotator.sh YOUR_STREAM_KEY

# Rotate every 5 minutes
./hcmc_stream_rotator.sh YOUR_STREAM_KEY 300

# Run in background with logging
nohup ./hcmc_stream_rotator.sh YOUR_STREAM_KEY > stream.log 2>&1 &

Option C: Run with Docker

# Build
docker build -t hcmc-streamer .

# Run
docker run -d --name hcmc-stream \
  -e YOUTUBE_KEY=your-key-here \
  hcmc-streamer

Refreshing Camera List

Camera URLs may change over time. To re-fetch the current list from the government API, run:

#!/bin/bash - refresh_cameras.sh
# Get session
curl -sk -c /tmp/c.txt "https://giaothong.hochiminhcity.gov.vn/Map.aspx" > /dev/null

# Fetch cameras with video streaming
for page in $(seq 1 10); do
  curl -sk -b /tmp/c.txt \
    -X POST \
    -H "X-AjaxPro-Method: SearchQuery" \
    -d "{\"path\":\"/root/vdms/tangthu/data/layerdata/camera\",
         \"isInTree\":false,\"searchKey\":\"\",
         \"layer\":[\"CAMERA\"],\"detail\":true,
         \"page\":$page,\"limit\":100,
         \"filterQuery\":[\"Publish:true\",\"VideoStreaming:1\"],
         \"sortby\":null,
         \"returnFields\":[\"DisplayName\",\"VideoUrl\"]}" \
    "https://giaothong.hochiminhcity.gov.vn/ajaxpro/\
VDMS.Web.Library.AJAX.FolderAjax,VDMS.Web.Library.ashx"
done | grep -oP '"Name":"VideoUrl"[^}]*"Value":"([^"]*)"' \
     | grep -oP 'http[^"]*'

All 69 Camera Streams

#Camera NameStream URL
1Quoc lo 1 - Cau Ben Cat 2http://camera.thongtingiaothong.vn/s/595dd6093dcfc400106f28ad/index.m3u8
2Tran Quoc Hoan - Phan Thuc Duyenhttp://camera.thongtingiaothong.vn/s/56df857fc062921100c143e7/index.m3u8
3QL1 - TTDK 50-07Vhttp://camera.thongtingiaothong.vn/s/59ca2e6002eb490011a0a3f3/index.m3u8
4QL1 - Cau vuot An Suonghttp://camera.thongtingiaothong.vn/s/595f91653dcfc400106f28f6/index.m3u8
5QL1 - Cau Binh Thuanhttp://camera.thongtingiaothong.vn/s/59ca2fa302eb490011a0a3fd/index.m3u8
6QL1 - Tram thu phi AS-AL 1http://camera.thongtingiaothong.vn/s/59ca2ecb02eb490011a0a3f6/index.m3u8
7QL1 - An Phu Dong 12http://camera.thongtingiaothong.vn/s/595d9ba43dcfc400106f2880/index.m3u8
8QL1 - Nga 4 Gahttp://camera.thongtingiaothong.vn/s/595dc70d3dcfc400106f289a/index.m3u8
9Duong ham - Dau Quan 1http://125.234.114.126:11984/api/stream.m3u8?src=TTH%2014.2%20...
10Mai Chi Tho - Nguyen Co Thachhttp://camera.thongtingiaothong.vn/s/5822b5ededeb6c0012a2d66a/index.m3u8
11Vo Van Kiet - Ky Conhttp://camera.thongtingiaothong.vn/s/56de42f611f398ec0c481287/index.m3u8
12Cao toc LTDG - Cau Ba Dat 2http://125.234.114.126:11984/api/stream.m3u8?src=Cao%20Toc%20LTDG%20...
13Nut giao Thu Duchttp://125.234.114.126:11984/api/stream.m3u8?src=Nut%20giao%20...
14Truong Chinh - Tay Thanhhttp://camera.thongtingiaothong.vn/s/5874796db807da0011e33cf7/index.m3u8
15Phan Dang Luu - Phan Xich Longhttp://camera.thongtingiaothong.vn/s/587ee2aeb807da0011e33d52/index.m3u8
16Truong Chinh - Tan Ky Tan Quyhttp://camera.thongtingiaothong.vn/s/586e25e1f9fab7001111b0ae/index.m3u8
17Vo Van Kiet - Ho Hoc Lamhttp://camera.thongtingiaothong.vn/s/56de42f611f398ec0c48129a/index.m3u8
18Vo Van Kiet - Hai Thuong Lan Onghttp://camera.thongtingiaothong.vn/s/56de42f611f398ec0c481293/index.m3u8
19Xa lo Ha Noi - Duong D1http://125.234.114.126:11984/api/stream.m3u8?src=Xa%20Lo%20Ha%20Noi%20...
20Vong xoay Mui Tau Phu Lamhttp://125.234.114.126:11984/api/stream.m3u8?src=Vong%20xoay%20...
21Kinh Duong Vuong - Ten Luahttp://125.234.114.126:11984/api/stream.m3u8?src=Kinh%20Duong%20...
22Mai Chi Tho - Dong Van Conghttp://125.234.114.126:11984/api/stream.m3u8?src=Mai%20Chi%20Tho%20...
23Vo Nguyen Giap - Thao Dienhttp://125.234.114.126:11984/api/stream.m3u8?src=Xa%20Lo%20Ha%20Noi%20...
24Nguyen Van Linh - Nguyen Luong Banghttp://camera.thongtingiaothong.vn/s/5abbb77298d8fc001102dfce/index.m3u8
25Cau vuot An Suong 2http://camera.thongtingiaothong.vn/s/59ca2cac02eb490011a0a3e9/index.m3u8

Showing 25 of 69. Full list available in the script and via the refresh API above.


Architecture


  HCMC Gov Traffic Cameras (Vietnam)
  +-----------------------------------------+
  | camera.thongtingiaothong.vn  (HLS CDN)  |
  | 125.234.114.126:11984       (Direct)    |
  +-------------------+---------------------+
                      |
                      | HLS (.m3u8)
                      v
  +-------------------+---------------------+
  |     Your VPS in Vietnam / Singapore     |
  |                                         |
  |  hcmc_stream_rotator.sh                 |
  |    - ffmpeg pulls HLS source            |
  |    - re-encodes to H264 1080p           |
  |    - overlays camera name               |
  |    - generates silent audio             |
  |    - rotates every N seconds            |
  |    - pushes RTMP to YouTube             |
  +-------------------+---------------------+
                      |
                      | RTMP
                      v
  +-------------------+---------------------+
  |           YouTube Live Stream           |
  |   rtmp://a.rtmp.youtube.com/live2/KEY   |
  +-----------------------------------------+

Troubleshooting

ProblemFix
Streams timeout / unreachableYou're not in Vietnam. Use a VPS in VN/SG or a Vietnam VPN.
ffprobe returns nothingCamera might be offline (CamStatus != UP). Try another URL from the list.
YouTube says "No data received"Check your stream key. Make sure YouTube Live is enabled on your channel.
Video is choppyReduce quality: change -maxrate 4500k to 2500k in the script.
Script stops after one cameraCamera died mid-stream. The script auto-skips and moves to the next one.
Want to add more camerasRun the refresh script above to get current URLs from the API.

Built by reverse-engineering the HCMC Department of Transport public API. Streams are public government infrastructure. Use responsibly.