Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stream MP4 video successfully to RTMP with FFMPEG [closed]

I'm attempted to stream an already recorded video file to twitch servers using FFMPEG but I only get audio so far no video. I've tried several settings, and different files (avi,etc) but I still get audio only. Here is my FFMPEG settings:

 ffmpeg -re -i test.mp4  -vcodec libx264 -preset fast -crf 30 -acodec aac -ab 128k -ar 44100 -strict experimental -f flv rtmp://live-dfw.twitch.tv/app/"TWITCHKEY"

Has anyone nailed this? I'm using ffmpeg 0.8.17-6:0.8.17-1 under Ubuntu.

like image 707
Fight Fire With Fire Avatar asked Nov 24 '15 00:11

Fight Fire With Fire


2 Answers

I'm not sure this needs so many options as the other answer. I have

ffmpeg -re -nostdin -i "$file" \
    -vcodec libx264 -preset:v ultrafast \
    -acodec aac \
    -f flv rtmp://live.twitch.tv/app/STREAM_KEY

and it seems to be working ok so far. ultrafast seems to be making my server melt less too.

The -re flag tells ffmpeg to read settings from the input file, so don't see why -r , -g etc are needed.

like image 187
BaronVonKaneHoffen Avatar answered Sep 28 '22 02:09

BaronVonKaneHoffen


ffmpeg -re -i ~/INPUT_FILE -vcodec libx264 -profile:v main -preset:v medium -r 30 -g 60 -keyint_min 60 -sc_threshold 0 -b:v 2500k -maxrate 2500k -bufsize 2500k -filter:v scale="trunc(oha/2)2:720" -sws_flags lanczos+accurate_rnd -acodec libfdk_aac -b:a 96k -ar 48000 -ac 2 -f flv rtmp://live.twitch.tv/app/STREAM_KEY

But please read the Twitch Rules of conduct before you post that Charle Sheen video.

like image 22
szatmary Avatar answered Sep 28 '22 01:09

szatmary