Stream MP4 video successfully to RTMP with FFMPEG

一笑奈何 提交于 2020-12-30 06:43:35

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/33883405/stream-mp4-video-successfully-to-rtmp-with-ffmpeg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!