[FFmpeg-user] text overlay will not work on rtmp stream

Anthony Griffiths neuronetv at gmail.com
Wed Sep 19 19:46:51 EEST 2018


On Wed, Sep 19, 2018 at 5:04 PM, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
> 2018-09-19 17:08 GMT+02:00, Anthony Griffiths <neuronetv at gmail.com>:
>> I stream video from a canopus advc100 device to a vps running nginx
>> using ffmpeg with the following command:
>> dvgrab -format dv1 - |
>> /home/<me>/Downloads/ffmpeg-git-20170817-64bit-static/ffmpeg
>> -deinterlace -f dv -i - \
>> -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 -f flv \
>> -framerate 15 -qscale:v 20 -codec:a aac -b:a 64k -af aformat=s16:44100
>> rtmp://<ip-address>/<name-nginx>
>>
>> the video plays fine at the other end but there is no text overlay on
>> the video. the file /home/<me>/screentext.txt does have text in it.
>>
>> whats strange is this command does work with text overlay. It streams
>> the same source to the same vps but to red5 server rather than nginx.
>> dvgrab -format dv1 - | /home/<me>/bin/ffmpeg -deinterlace -f dv -i - -f flv
>> \
>> -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]
>> \
>> -y -vcodec flv -s 320x240 -r 10 -b:v 400k -vcodec libx264 -preset
>
> This command looks wrong because you are requesting
> two different video codecs which is likely undefined
> behaviour.
>
>> veryfast -crf 25 -maxrate 1000k -bufsize 6000k \
>> -g 20 -c:a libfdk_aac -ac 1 -ab 32k -ar 22050
>> 'rtmp://<ip-address>/<name-red5>'
>>
>> The first command is the one I want to use because it works for
>> playback on a smart phone but i can't get the text overlay to work.
>> can anyone see whats wrong with the command?
>
> Feel free to provide the complete, uncut console output of the
> command you tested.
>
> Carl Eugen

thankyou for your input. I'm struggling to understand what you mean by
two different video codecs as you didn't specify which however, here
is the console output from the first command:

ffmpeg version 2.5.3 Copyright (c) 2000-2015 the FFmpeg developers
  built on Jan 22 2015 21:08:41 with gcc 4.8.3 (GCC) 20140911 (Red Hat 4.8.3-7)
  configuration: --prefix=/home/<me>/ffmpeg_build
--extra-cflags=-I/home/<me>/ffmpeg_build/include
--extra-ldflags=-L/home/<me>/ffmpeg_build/lib --bindir=/home/<me>/bin
--e xtra-libs=-ldl --enable-gpl --enable-nonfree --enable-libfdk_aac
--enable-libx264 --enable-libfreetype --enable-libfontconfig
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 13.100 / 56. 13.100
  libavformat    56. 15.102 / 56. 15.102
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, dv, from 'pipe:':
  Duration: N/A, start: 0.000000, bitrate: 28800 kb/s
    Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 16:15 DAR 4:3],
28800 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
[libx264 @ 0x2c72660] -qscale is ignored, -crf is recommended.
[libx264 @ 0x2c72660] max bitrate less than average bitrate, assuming CBR
[libx264 @ 0x2c72660] using SAR=1/1
[libx264 @ 0x2c72660] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
[libx264 @ 0x2c72660] profile High, level 1.3
[libx264 @ 0x2c72660] 264 - core 144 r2 40bb568 - H.264/MPEG-4 AVC
codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html -
options: cabac=1 ref=5 deblock=1:0:0 ana lyse=0x3:0x113 me=umh subme=8
psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1
8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2
threads=3  lookahead_threads=1 sliced_threads=0 nr=0 decimate=1
interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2
b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0  weightp=2 keyint=250
keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=cbr
mbtree=1 bitrate=500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4
vbv_maxrate=500  vbv_bufsize=1000 nal_hrd=none filler=0 ip_ratio=1.40
aq=1:1.00
Output #0, flv, to 'rtmp://<ip-address>/<name-nginx>':
  Metadata:
    encoder         : Lavf56.15.102
    Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007),
yuv420p, 320x180 [SAR 1:1 DAR 16:9], q=-1--1, 1500 kb/s, 25 fps, 1k
tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.13.100 libx264
    Stream #0:1: Audio: aac (libfdk_aac) ([10][0][0][0] / 0x000A),
44100 Hz, stereo, s16, 64 kb/s
    Metadata:
      encoder         : Lavc56.13.100 libfdk_aac
Stream mapping:
  Stream #0:0 -> #0:0 (dvvideo (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (pcm_s16le (native) -> aac (libfdk_aac))
frame=  741 fps= 26 q=19.0 size=    1910kB time=00:00:29.62 bitrate=
528.2kbits/s


More information about the ffmpeg-user mailing list