Rotate government traffic cameras on your YouTube live stream — HCMC & NYC
Source: 511ny.org public API / NYS DOT — HLS streams, no auth, accessible from anywhere
Source: giaothong.hochiminhcity.gov.vn — requires Vietnam VPS or VPN
curl -fsSL GRIDWORK_URL/nyc_stream_rotator.sh -o nyc.sh && chmod +x nyc.sh && ./nyc.sh YOUR_YT_KEY
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.
| City | Cameras | Source | Access |
|---|---|---|---|
| New York City | 316 (1,541 statewide) | 511ny.org public API / NYS DOT | Worldwide — no auth |
| Ho Chi Minh City | 69 | giaothong.hochiminhcity.gov.vn | Vietnam network only |
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.
# 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 &
# 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"
# 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\"]}')
"
| # | Camera | Area | Stream URL |
|---|---|---|---|
| 1 | West St @ West Houston St | Manhattan | https://s9.nysdot.skyvdn.com:443/rtplive/R11_271/playlist.m3u8 |
| 2 | West St @ W 34 St | Manhattan | https://s9.nysdot.skyvdn.com:443/rtplive/R11_272/playlist.m3u8 |
| 3 | West St @ W 57 St | Manhattan | https://s9.nysdot.skyvdn.com:443/rtplive/R11_273/playlist.m3u8 |
| 4 | Harlem River Dr @ 127 St | Manhattan | https://s7.nysdot.skyvdn.com:443/rtplive/R11_153/playlist.m3u8 |
| 5 | Harlem River Dr @ 135 St | Manhattan | https://s9.nysdot.skyvdn.com:443/rtplive/R11_251/playlist.m3u8 |
| 6 | Henry Hudson Pkwy @ W 66 St | Manhattan | https://s9.nysdot.skyvdn.com:443/rtplive/R11_242/playlist.m3u8 |
| 7 | Henry Hudson Pkwy @ W 119 St | Manhattan | https://s9.nysdot.skyvdn.com:443/rtplive/R11_260/playlist.m3u8 |
| 8 | Henry Hudson Pkwy @ La Salle | Manhattan | https://s7.nysdot.skyvdn.com:443/rtplive/R11_258/playlist.m3u8 |
| 9 | I-495 Queens Midtown Tunnel | Tunnel | https://s51.nysdot.skyvdn.com:443/rtplive/R11_127/playlist.m3u8 |
| 10 | I-87 @ Macombs Dam Bridge | Bridge | https://s52.nysdot.skyvdn.com:443/rtplive/R11_044/playlist.m3u8 |
| 11 | I-87 Gov Cuomo Bridge | Bridge | https://s53.nysdot.skyvdn.com:443/rtplive/TA_028/playlist.m3u8 |
| 12 | I-678 Van Wyck @ North Conduit | Queens/JFK | https://s7.nysdot.skyvdn.com:443/rtplive/R11_157/playlist.m3u8 |
| 13 | I-678 Van Wyck @ LIE | Queens | https://s7.nysdot.skyvdn.com:443/rtplive/R11_183/playlist.m3u8 |
| 14 | I-678 Van Wyck @ Northern Blvd | Queens | https://s7.nysdot.skyvdn.com:443/rtplive/R11_186/playlist.m3u8 |
| 15 | I-678 Whitestone @ 14th Ave | Queens | https://s7.nysdot.skyvdn.com:443/rtplive/R11_188/playlist.m3u8 |
| 16 | I-495 LIE @ 220th St | Queens | https://s7.nysdot.skyvdn.com:443/rtplive/R11_154/playlist.m3u8 |
| 17 | I-95 Bruckner @ Buhre Ave | Bronx | https://s52.nysdot.skyvdn.com:443/rtplive/R11_012/playlist.m3u8 |
| 18 | I-95 @ Hutchinson River Pkwy | Bronx | https://s53.nysdot.skyvdn.com:443/rtplive/TA_051/playlist.m3u8 |
| 19 | I-278 @ Richmond Ave | Staten Island | https://s7.nysdot.skyvdn.com:443/rtplive/R11_211/playlist.m3u8 |
| 20 | I-278 @ Victory Blvd | Staten Island | https://s7.nysdot.skyvdn.com:443/rtplive/R11_213/playlist.m3u8 |
| 21 | Korean War Vets Pkwy @ Tyrellan | Staten Island | https://s7.nysdot.skyvdn.com:443/rtplive/R11_189/playlist.m3u8 |
| 22 | I-87 @ Ardsley | Westchester | https://s53.nysdot.skyvdn.com:443/rtplive/TA_021/playlist.m3u8 |
| 23 | I-87 @ Saw Mill River Pkwy | Westchester | https://s53.nysdot.skyvdn.com:443/rtplive/TA_022/playlist.m3u8 |
| 24 | I-95 @ New Rochelle | Westchester | https://s53.nysdot.skyvdn.com:443/rtplive/TA_052/playlist.m3u8 |
| 25 | I-87 Gov Cuomo Bridge 2 | Westchester | https://s53.nysdot.skyvdn.com:443/rtplive/TA_030/playlist.m3u8 |
Full list of 316 NYC cameras available via the API above.
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:
"CAMERA"FolderAjax.SearchQuery) to load camera datatype="application/x-mpegURL" (HLS)VideoUrl contains the direct m3u8 stream URLThe 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"
Two types of stream endpoints were found:
| Type | Pattern | Count |
|---|---|---|
| VOV CDN | http://camera.thongtingiaothong.vn/s/{id}/index.m3u8 | ~35 |
| Direct HLS | http://125.234.114.126:11984/api/stream.m3u8?src={name} | ~34 |
The script uses ffmpeg to pull each HLS stream, re-encode to H264 1080p, overlay the camera name, and push to YouTube via RTMP.
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.
curl -fsSL GRIDWORK_URL/setup_vietnam.sh | bash
Then run:
./hcmc_stream_rotator.sh YOUR_YOUTUBE_STREAM_KEY
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
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 &
# Build
docker build -t hcmc-streamer .
# Run
docker run -d --name hcmc-stream \
-e YOUTUBE_KEY=your-key-here \
hcmc-streamer
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[^"]*'
| # | Camera Name | Stream URL |
|---|---|---|
| 1 | Quoc lo 1 - Cau Ben Cat 2 | http://camera.thongtingiaothong.vn/s/595dd6093dcfc400106f28ad/index.m3u8 |
| 2 | Tran Quoc Hoan - Phan Thuc Duyen | http://camera.thongtingiaothong.vn/s/56df857fc062921100c143e7/index.m3u8 |
| 3 | QL1 - TTDK 50-07V | http://camera.thongtingiaothong.vn/s/59ca2e6002eb490011a0a3f3/index.m3u8 |
| 4 | QL1 - Cau vuot An Suong | http://camera.thongtingiaothong.vn/s/595f91653dcfc400106f28f6/index.m3u8 |
| 5 | QL1 - Cau Binh Thuan | http://camera.thongtingiaothong.vn/s/59ca2fa302eb490011a0a3fd/index.m3u8 |
| 6 | QL1 - Tram thu phi AS-AL 1 | http://camera.thongtingiaothong.vn/s/59ca2ecb02eb490011a0a3f6/index.m3u8 |
| 7 | QL1 - An Phu Dong 12 | http://camera.thongtingiaothong.vn/s/595d9ba43dcfc400106f2880/index.m3u8 |
| 8 | QL1 - Nga 4 Ga | http://camera.thongtingiaothong.vn/s/595dc70d3dcfc400106f289a/index.m3u8 |
| 9 | Duong ham - Dau Quan 1 | http://125.234.114.126:11984/api/stream.m3u8?src=TTH%2014.2%20... |
| 10 | Mai Chi Tho - Nguyen Co Thach | http://camera.thongtingiaothong.vn/s/5822b5ededeb6c0012a2d66a/index.m3u8 |
| 11 | Vo Van Kiet - Ky Con | http://camera.thongtingiaothong.vn/s/56de42f611f398ec0c481287/index.m3u8 |
| 12 | Cao toc LTDG - Cau Ba Dat 2 | http://125.234.114.126:11984/api/stream.m3u8?src=Cao%20Toc%20LTDG%20... |
| 13 | Nut giao Thu Duc | http://125.234.114.126:11984/api/stream.m3u8?src=Nut%20giao%20... |
| 14 | Truong Chinh - Tay Thanh | http://camera.thongtingiaothong.vn/s/5874796db807da0011e33cf7/index.m3u8 |
| 15 | Phan Dang Luu - Phan Xich Long | http://camera.thongtingiaothong.vn/s/587ee2aeb807da0011e33d52/index.m3u8 |
| 16 | Truong Chinh - Tan Ky Tan Quy | http://camera.thongtingiaothong.vn/s/586e25e1f9fab7001111b0ae/index.m3u8 |
| 17 | Vo Van Kiet - Ho Hoc Lam | http://camera.thongtingiaothong.vn/s/56de42f611f398ec0c48129a/index.m3u8 |
| 18 | Vo Van Kiet - Hai Thuong Lan Ong | http://camera.thongtingiaothong.vn/s/56de42f611f398ec0c481293/index.m3u8 |
| 19 | Xa lo Ha Noi - Duong D1 | http://125.234.114.126:11984/api/stream.m3u8?src=Xa%20Lo%20Ha%20Noi%20... |
| 20 | Vong xoay Mui Tau Phu Lam | http://125.234.114.126:11984/api/stream.m3u8?src=Vong%20xoay%20... |
| 21 | Kinh Duong Vuong - Ten Lua | http://125.234.114.126:11984/api/stream.m3u8?src=Kinh%20Duong%20... |
| 22 | Mai Chi Tho - Dong Van Cong | http://125.234.114.126:11984/api/stream.m3u8?src=Mai%20Chi%20Tho%20... |
| 23 | Vo Nguyen Giap - Thao Dien | http://125.234.114.126:11984/api/stream.m3u8?src=Xa%20Lo%20Ha%20Noi%20... |
| 24 | Nguyen Van Linh - Nguyen Luong Bang | http://camera.thongtingiaothong.vn/s/5abbb77298d8fc001102dfce/index.m3u8 |
| 25 | Cau vuot An Suong 2 | http://camera.thongtingiaothong.vn/s/59ca2cac02eb490011a0a3e9/index.m3u8 |
Showing 25 of 69. Full list available in the script and via the refresh API above.
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 |
+-----------------------------------------+
| Problem | Fix |
|---|---|
| Streams timeout / unreachable | You're not in Vietnam. Use a VPS in VN/SG or a Vietnam VPN. |
| ffprobe returns nothing | Camera 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 choppy | Reduce quality: change -maxrate 4500k to 2500k in the script. |
| Script stops after one camera | Camera died mid-stream. The script auto-skips and moves to the next one. |
| Want to add more cameras | Run 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.