[FFmpeg-user] text overlay will not work on rtmp stream
barsnick at gmx.net
Thu Sep 20 14:27:07 EEST 2018
On Thu, Sep 20, 2018 at 10:24:55 +0100, Anthony Griffiths wrote:
> On Thu, Sep 20, 2018 at 9:59 AM, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
> > 2018-09-20 10:46 GMT+02:00, Anthony Griffiths <neuronetv at gmail.com>:
> > The problem was not that you used "-f flv -vcodec libx264" but
> > "-f flv -vcodec flv -vcodec libx264"
> now I'm really puzzled, because in the command I just gave there's -f
> flv and -codec:v libx264, there is no -vcodec flv or -vcodec libx264
It was an error in your second command given, where you had written:
"whats strange is this command does work with text overlay".
I'm now assuming this is the command you wish to get working:
> dvgrab -format dv1 - | \
> /home/<me>/Downloads/ffmpeg-git-20180920-64bit-static/ffmpeg \
> -deinterlace -f dv -i - -f flv -y \
> -vf [in]drawtext="fontfile=/home/<me>/packages/Fonts/verdana.ttf:textfile=/home/<me>/screentext.txt:fontcolor=white:fontsize=20:x=30:y=30:reload=1"[out] \
> -codec:v libx264 -preset slow -aspect 16:9 -s 320x180 -b:v 1500k -maxrate 500k -bufsize 1000k -vf scale=-1:240 -threads 0
> -framerate 15 -qscale:v 20 -codec:a aac -b:a 64k -af aformat=s16:44100 rtmp://<ip-address>/<name-nginx>"
One thing to always first do when debugging is to e.g. change the
output to a file, such as output.mkv or output.mp4, and see whether the
desired effect is missing there as well.
Your issue is likely:
You're passing "-vf" twice. Only one of them is taken into
consideration! (Perhaps ffmpeg should warn, but it isn't implemented to
do so right now.) That's why your drawfile is probably ignored. "ffmpeg
-loglevel debug" would show the actually used filter chains. (Even
without the loglevel, it should be obvious what is missing.)
If you want several filters, you need to combine them to a chain:
$ -vf "drawtext=...,scale=..."
I don't think "-vf" actually handles "[in]" and "[out]" - you're not
even telling it what "[in]" is, so this "-vf" option is obviously just
"-deinterlace" inserts a deinterlace filter somewhere. I'm not sure
about the cross-effect on "-vf", so better to explicitly insert a
particular deinterlace filter in your chain.
I don't know what the effect of "-vf scale=-1:240 -s 320x180" is. I
believe the latter argument inserts (another) scale filter at the end.
Why not just "-vf scale=-1:180" and drop "-s ..."?? You need to think
about what you are trying to achieve, and best put all into one filter
$ ffmpeg -i input -vf "yadif=...,drawtext=fontfile=/home/<me>/packages/Fonts/verdana.ttf:textfile=/home/<me>/screentext.txt:fontcolor=white:fontsize=20:x=30:y=30:reload=1,scale=-1:180" [...]
More information about the ffmpeg-user