【发布时间】:2017-07-15 08:28:06
【问题描述】:
目前我正在尝试在 Kubuntu 中使用 ffmpeg 设置直播。我真的走了很远,但不幸的是我无法弄清楚提到输出格式错误的一点。这是我用于 .sh 文件的代码:
#! /bin/bash
# streaming on Ubuntu via ffmpeg.
# see http://ubuntuguide.org/wiki/Screencasts for full documentation
# input resolution, currently fullscreen.
# you can set it manually in the format "WIDTHxHEIGHT" instead.
INRES="1920x1200"
# output resolution.
# keep the aspect ratio the same or your stream will not fill the display.
OUTRES="1280x720"
# input audio. You can use "/dev/dsp" for your primary audio input.
#INAUD="pulse"
# target fps
FPS="30"
# video preset quality level.
# more FFMPEG presets avaiable in /usr/share/ffmpeg
QUAL="ultrafast"
# stream key. You can set this manually, or reference it from a hidden file
like what is done here.
STREAM_KEY=$(cat ~/.twitch_key)
# stream url. Note the formats for twitch.tv and justin.tv
# twitch:"rtmp://live.twitch.tv/app/$STREAM_KEY"
# justin:"rtmp://live.justin.tv/app/$STREAM_KEY"
STREAM_URL="rtmp://live-cdg.twitch.tv/app/$STREAM_KEY"
ffmpeg \
-f alsa -ac 2 -i "$INAUD" \
-f x11grab -s "$INRES" -r "$FPS" -i :50.0 \
-vcodec libx264 -s "$OUTRES" -preset "$QUAL" -crf 22\
-acodec libmp3lame -threads 6 -q:a 0 -b:a 160k \
-f flv -ar 44100 "$STREAM_URL"
现在的问题是,每当我运行 .sh 文件时,最后都会出现错误提示
Unable to find a suitable output format for 'libmp3lame'
libmp3lame: Invalid argument
所以我决定通过删除底部的音频线来解决问题,它就变成了
Unable to find a suitable output format for 'flv'
flv: Invalid argument
有人告诉我这是因为流键定义不正确,但我不知道如何解决这个问题。
那么有人有想法吗? 提前致谢!
先生1
【问题讨论】: