Saturday, 26 May 2018

FFmpeg Script Trancoding on Centos

Play loop file

ffmpeg -re -i "http://127.0.0.1/content/sample.mp4" -vcodec libx264 -preset fast -crf 30 -acodec aac -ab 128k -ar 44100 -strict experimental -f flv "rtmp://127.0.0.1/stream/live"`

Tanscoder Wowza ------------------------------------

#!/bin/bash
while :
do
  echo `ffmpeg -re -i "rtmp://127.0.0.1:1935/rtv1/live" -c copy \-s 1280x720 -f flv -vcodec libx264 -profile:v baseline -maxrate 1300000 -bufsize 1300000 -r 25 -ar 44100 -c:a libfaac -b:a 128k "rtmp://127.0.0.1/stream/live_720?trebor&adbe-live-event=ffmpeg" \-s 640x360 -ac 2 -f flv -vcodec libx264 -profile:v baseline -maxrate 850000 -bufsize 850000 -r 25 -ar 44100 -c:a libfaac -b:a 128k "rtmp://127.0.0.1/stream/live_360?trebor&adbe-live-event=ffmpeg" \-s 360x240 -ac 2 -f flv -vcodec libx264 -profile:v baseline -maxrate 350000 -bufsize 350000 -r 25 -ar 44100 -c:a libfaac -b:a 128k "rtmp://127.0.0.1/stream/live_240?trebor&adbe-live-event=ffmpeg" \-s 284x160 -ac 2 -f flv -vcodec libx264 -profile:v baseline -maxrate 250000 -bufsize 250000 -r 25 -ar 44100 -c:a libfaac -b:a 128k "rtmp://127.0.0.1/stream/live_160?trebor&adbe-live-event=ffmpeg"`
done

save to transcoder.sh
autorun Centos vi /etc/rc.d/rc.local

ffmpeg -re -i "rtmp://cyber3.cf:1935/stream/live" -c copy -f flv "rtmp://127.0.0.1/rtv/live"
ffmpeg -re -i "rtmp://127.0.0.1:1935/stream/live" -c copy -f flv "rtmp://127.0.0.1/rtv/live"
ffmpeg -re -i "rtmp://127.0.0.1:1935/stream/live" -c copy -f flv "rtmp://127.0.0.1/rtv/live pubUser=?/ pubPasswd=?/"
==================

ffmpeg -re -i http://127.0.0.1/content/cb.mp4 -flags +global_header -acodec libmp3lame -ac 1 -ar 44100 -ab 192k -s 1280x720 -vcodec libx264 -pix_fmt yuv420p -g 60 -vb 1700k -profile:v baseline -preset:v faster -r 30 -f flv "rtmp://127.0.0.1/play/live"

No comments:

Post a Comment