目前,我正在尝试在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

告诉我这是因为流密钥没有正确定义,但是我不知道如何解决此问题。

那有人有想法吗?
提前致谢!

Misterff1

最佳答案

在此处插入空格:

-crf 22\

所以
-crf 22 \

10-05 23:15