- input camera source command:
- output http command:
for example(get camera source then output to 8000 port with credentials):
mjpg_streamer -i "input_uvc.so" -o "output_http.so -p 8000 -c username:password"
#! /bin/bash | |
VBR="2000k" | |
FPS="30" | |
QUAL="medium" | |
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" | |
SOURCE="http://REPLACE_WITH_933L_IP/h264.flv" | |
KEY="" | |
ffmpeg \ | |
-i "$SOURCE" -deinterlace \ | |
-vcodec libx264 -pix_fmt yuv420p -preset $QUAL -r $FPS -g $(($FPS * 2)) -b:v $VBR \ | |
-acodec libmp3lame -ar 44100 -threads 6 -qscale 3 -b:a 712000 -bufsize 512k \ | |
-f flv "$YOUTUBE_URL/$KEY" |
#!/bin/sh | |
SESSION_NAME="mjpeg_relay" | |
cd mjpeg-relay | |
tmux has-session -t $SESSION_NAME | |
if [ $? != 0 ] | |
then | |
tmux new-session -s $SESSION_NAME -n one -d | |
tmux send-keys -t $SESSION_NAME "python relay.py -p 1001 -w 2001 http://140.112.91.176:8001/stream" C-m | |
tmux new-window -n two -t $SESSION_NAME | |
tmux send-keys -t $SESSION_NAME:1 "python relay.py -p 1002 -w 2002 http://140.112.91.176:8002/stream" C-m | |
tmux new-window -n three -t $SESSION_NAME | |
tmux send-keys -t $SESSION_NAME:2 "python relay.py -p 1003 -w 2003 http://140.112.91.176:8003/stream" C-m | |
tmux new-window -n four -t $SESSION_NAME | |
tmux send-keys -t $SESSION_NAME:3 "python relay.py -p 1004 -w 2004 http://140.112.91.176:8004/stream" C-m | |
tmux new-window -n five -t $SESSION_NAME | |
tmux send-keys -t $SESSION_NAME:4 "python relay.py -p 1005 -w 2005 http://140.112.91.176:8005/stream" C-m | |
tmux new-window -n six -t $SESSION_NAME | |
tmux send-keys -t $SESSION_NAME:5 "python relay.py -p 1006 -w 2006 http://140.112.91.176:8006/stream" C-m | |
tmux new-window -n seven -t $SESSION_NAME | |
tmux send-keys -t $SESSION_NAME:6 "python relay.py -p 1007 -w 2007 http://140.112.91.176:8007/stream" C-m | |
tmux new-window -n eight -t $SESSION_NAME | |
tmux send-keys -t $SESSION_NAME:7 "python relay.py -p 1008 -w 2008 http://140.112.91.176:8008/stream" C-m | |
tmux new-window -n nine -t $SESSION_NAME | |
tmux send-keys -t $SESSION_NAME:8 "python relay.py -p 1009 -w 2009 http://140.112.91.176:8009/stream" C-m | |
tmux new-window -n ten -t $SESSION_NAME | |
tmux send-keys -t $SESSION_NAME:9 "python relay.py -p 1010 -w 2010 http://140.112.91.176:8010/stream" C-m | |
fi | |
tmux attach -t $SESSION_NAME |
for example(get camera source then output to 8000 port with credentials):
mjpg_streamer -i "input_uvc.so" -o "output_http.so -p 8000 -c username:password"
opkg update
opkg install nginx
vim /etc/nginx/nginx.conf
rewrite http block(replace listen(can also use 7777) and rewrite url)
server {
listen 7777; #[here]port to redirect
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
rewrite ^ http://192.168.0.1/stream permanent; #[here]redirect to http://192.168.0.1/stream (this is LAN ipcam)
}
restart nginx
/etc/init.d/nginx restart
vim /etc/config/dropbear
add option SSHKeepAlive 60
to behind
vim /etc/init.d/tunnel-builder
#!/bin/sh /etc/rc.common
# Example script
# Copyright (C) 2007 OpenWrt.org
START=50
start() {
ssh -NfR 7773:localhost:7777 [email protected] -i /root/nopass
}
ssh reverse tunnel description:
ssh -NfR [remote port to access local host's port]:localhost:7777 [email protected] -i /root/nopass
avconv -rtsp_transport tcp -i "$RTSP" -b:a 128k -f s16le -ar 44100 -ac 2 -i /dev/zero -codec:v libx264 -codec:a aac -f flv -strict experimental "$YOUTUBE_RTMP" |