[FFmpeg-user] drawtext filter use with stream output?

Alex Morris axman.5389 at gmail.com
Wed Sep 4 17:46:50 CEST 2013


Hello

Thank you to the developers for this software, and to the user
community for support.

Question:  When using the drawtext filter, is different syntax
required when the final output is a stream?

I searched this list but did not see a similar issue..  Perhaps I did
not search well enough..

Using ffmpeg version 2.0 compiled from Sept 3, 2013 snapshot.  I
capture live NTSC from a GoPro with ffmpeg.  I stream it to ffserver.
The capture and output stream works.  I would like to overlay the date
and time into the final output stream before sending to ffserver.

If I output to a file, (flv in my test case) the drawtext filter works
perfectly.  Date and time are overlayed into the resulting flv file,
ffplay and vlc both show it nicely.

If I output to a stream, there is no text overlay visible in the
output stream displayed.  (ffserver receives it, and ffplay can
consume it from that ffserver, and plays it fine.  just no text
overlay.  same with vlc as client.)

I run tests with -debug 1 and it shows that my syntax is correct.  I
think.  But it does not show any hints about why the drawtext filter
is not included in the output.

Any clue is appreciated.

Kind regards,
Alex


command
--------
/usr/local/bin/ffmpeg -debug 1 -f alsa -r 48000 -ac 2 -channel_layout
stereo -i hw:0 -f v4l2 -channel 1 -pix_fmt uyvy422 -i /dev/video0 -vf
drawtext="/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf:
text='%{localtime\:%F_%T}': x=20: y=20: fontsize=24: fontcolor=green:
fontsize=24" -c:a libmp3lame -b:a 128k -ar 44100 -ac 2 -c:v flv -b:v
768k -s 720x480 -r 30 http://192.168.1.105:8092/test.flv 2>
/home/ajm/scripts/ffmpeg_log.txt

gives these results
--------
ffmpeg version 2.0 Copyright (c) 2000-2013 the FFmpeg developers
  built on Sep  2 2013 11:52:39 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-libfaac --enable-libmp3lame
--enable-libopenjpeg --enable-libtheora --enable-libv4l2
--enable-libvorbis --enable-libxvid --enable-gpl --enable-nonfree
--enable-static --enable-librtmp --enable-libtwolame --enable-x11grab
--enable-libvpx --enable-libx264 --enable-fontconfig
--enable-libfreetype
  libavutil      52. 42.100 / 52. 42.100
  libavcodec     55. 29.100 / 55. 29.100
  libavformat    55. 14.102 / 55. 14.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 82.102 /  3. 82.102
  libswscale      2.  5.100 /  2.  5.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
 matched as AVOption 'debug' with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with
argument 'alsa'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz
value, fraction or abbreviation)) with argument '48000'.
Reading option '-ac' ... matched as option 'ac' (set number of audio
channels) with argument '2'.
Reading option '-channel_layout' ... matched as option
'channel_layout' (set channel layout) with argument 'stereo'.
Reading option '-i' ... matched as input file with argument 'hw:0'.
Reading option '-f' ... matched as option 'f' (force format) with
argument 'v4l2'.
Reading option '-channel' ... matched as AVOption 'channel' with argument '1'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel
format) with argument 'uyvy422'.
Reading option '-i' ... matched as input file with argument '/dev/video0'.
Reading option '-vf' ... matched as option 'vf' (set video filters)
with argument 'drawtext=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf:
text='%{localtime\:%F_%T}': x=20: y=20: fontsize=24: fontcolor=green:
fontsize=24'.
Reading option '-c:a' ... matched as option 'c' (codec name) with
argument 'libmp3lame'.
Reading option '-b:a' ... matched as option 'b' (video bitrate (please
use -b:v)) with argument '128k'.
Reading option '-ar' ... matched as option 'ar' (set audio sampling
rate (in Hz)) with argument '44100'.
Reading option '-ac' ... matched as option 'ac' (set number of audio
channels) with argument '2'.
Reading option '-c:v' ... matched as option 'c' (codec name) with
argument 'flv'.
Reading option '-b:v' ... matched as option 'b' (video bitrate (please
use -b:v)) with argument '768k'.
Reading option '-s' ... matched as option 's' (set frame size (WxH or
abbreviation)) with argument '720x480'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz
value, fraction or abbreviation)) with argument '30'.
Reading option 'http://192.168.1.105:8092/feed2.ffm' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Successfully parsed a group of options.
Parsing a group of options: input file hw:0.
Applying option f (force format) with argument alsa.
Applying option r (set frame rate (Hz value, fraction or
abbreviation)) with argument 48000.
Applying option ac (set number of audio channels) with argument 2.
Applying option channel_layout (set channel layout) with argument stereo.
Successfully parsed a group of options.
Opening an input file: hw:0.
[alsa @ 0x1ad1ba0] All info found
Input #0, alsa, from 'hw:0':
  Duration: N/A, start: 1378236996.360348, bitrate: 1536 kb/s
    Stream #0:0, 1, 1/1000000: Audio: pcm_s16le, 48000 Hz, stereo,
s16, 1536 kb/s
Successfully opened the file.
Parsing a group of options: input file /dev/video0.
Applying option f (force format) with argument v4l2.
Applying option pix_fmt (set pixel format) with argument uyvy422.
Successfully parsed a group of options.
Opening an input file: /dev/video0.
[video4linux2,v4l2 @ 0x1ae35c0] fd:4 capabilities:5030011
[video4linux2,v4l2 @ 0x1ae35c0] Selecting input_channel: 1
[video4linux2,v4l2 @ 0x1ae35c0] Current input_channel: 1, input_name: Composite
[video4linux2,v4l2 @ 0x1ae35c0] Querying the device for the current frame size
[video4linux2,v4l2 @ 0x1ae35c0] Setting frame size to 720x480
[video4linux2,v4l2 @ 0x1ae35c0] The V4L2 driver is using the interlaced mode
[video4linux2,v4l2 @ 0x1ae35c0] Current standard: NTSC-M, id: 4096,
frameperiod: 1001/30000
[video4linux2,v4l2 @ 0x1ae35c0] All info found
Input #1, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 1378236997.016181, bitrate: 165722 kb/s
    Stream #1:0, 1, 1/1000000: Video: rawvideo (UYVY / 0x59565955),
uyvy422, 720x480, 1/1000000, 165722 kb/s, 29.97 fps, 29.97 tbr, 1000k
tbn, 1000k tbc
Successfully opened the file.
Parsing a group of options: output file http://192.168.1.105:8092/feed2.ffm.
Applying option vf (set video filters) with argument
drawtext=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf:
text='%{localtime\:%F_%T}': x=20: y=20: fontsize=24: fontcolor=green:
fontsize=24.
Applying option c:a (codec name) with argument libmp3lame.
Applying option b:a (video bitrate (please use -b:v)) with argument 128k.
Applying option ar (set audio sampling rate (in Hz)) with argument 44100.
Applying option ac (set number of audio channels) with argument 2.
Applying option c:v (codec name) with argument flv.
Applying option b:v (video bitrate (please use -b:v)) with argument 768k.
Applying option s (set frame size (WxH or abbreviation)) with argument 720x480.
Applying option r (set frame rate (Hz value, fraction or
abbreviation)) with argument 30.
Successfully parsed a group of options.
Opening an output file: http://192.168.1.105:8092/feed2.ffm.
[ffm @ 0x1ae7c80] Format ffm probed with size=2048 and score=101
[AVIOContext @ 0x1ae59c0] Statistics: 4096 bytes read, 0 seeks
Successfully opened the file.
detected 4 logical cores
[graph 0 input from stream 0:0 @ 0x1aef1c0] Setting 'time_base' to
value '1/48000'
[graph 0 input from stream 0:0 @ 0x1aef1c0] Setting 'sample_rate' to
value '48000'
[graph 0 input from stream 0:0 @ 0x1aef1c0] Setting 'sample_fmt' to value 's16'
[graph 0 input from stream 0:0 @ 0x1aef1c0] Setting 'channel_layout'
to value '0x3'
[graph 0 input from stream 0:0 @ 0x1aef1c0] tb:1/48000 samplefmt:s16
samplerate:48000 chlayout:0x3
[audio format for output stream 0:0 @ 0x1ae7c80] Setting 'sample_fmts'
to value 's32p'
[audio format for output stream 0:0 @ 0x1ae7c80] Setting
'sample_rates' to value '44100'
[audio format for output stream 0:0 @ 0x1ae7c80] Setting
'channel_layouts' to value '0x3'
[audio format for output stream 0:0 @ 0x1ae7c80] auto-inserting filter
'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and
the filter 'audio format for output stream 0:0'
[AVFilterGraph @ 0x1aeb700] query_formats: 4 queried, 6 merged, 3
already done, 0 delayed
[auto-inserted resampler 0 @ 0x1abbd00] ch:2 chl:stereo fmt:s16
r:48000Hz -> ch:2 chl:stereo fmt:s32p r:44100Hz
[graph 1 input from stream 1:0 @ 0x1ae9680] Setting 'video_size' to
value '720x480'
[graph 1 input from stream 1:0 @ 0x1ae9680] Setting 'pix_fmt' to value '17'
[graph 1 input from stream 1:0 @ 0x1ae9680] Setting 'time_base' to
value '1/1000000'
[graph 1 input from stream 1:0 @ 0x1ae9680] Setting 'pixel_aspect' to
value '0/1'
[graph 1 input from stream 1:0 @ 0x1ae9680] Setting 'sws_param' to
value 'flags=2'
[graph 1 input from stream 1:0 @ 0x1ae9680] Setting 'frame_rate' to
value '30000/1001'
[graph 1 input from stream 1:0 @ 0x1ae9680] w:720 h:480 pixfmt:uyvy422
tb:1/1000000 fr:30000/1001 sar:0/1 sws_param:flags=2
[scaler for output stream 0:1 @ 0x1ac08a0] Setting 'w' to value '720'
[scaler for output stream 0:1 @ 0x1ac08a0] Setting 'h' to value '480'
[scaler for output stream 0:1 @ 0x1ac08a0] Setting 'flags' to value '0x4'
[scaler for output stream 0:1 @ 0x1ac08a0] w:720 h:480 flags:'0x4' interl:0
[format @ 0x1ae92e0] compat: called with args=[yuv420p]
[format @ 0x1ae92e0] Setting 'pix_fmts' to value 'yuv420p'
[AVFilterGraph @ 0x1ae5e60] query_formats: 5 queried, 4 merged, 0
already done, 0 delayed
[scaler for output stream 0:1 @ 0x1ac08a0] w:720 h:480 fmt:uyvy422
sar:0/1 -> w:720 h:480 fmt:yuv420p sar:0/1 flags:0x4
[flv @ 0x1aef6e0] intra_quant_bias = 0 inter_quant_bias = -64
Output #0, ffm, to 'http://192.168.1.105:8092/feed2.ffm':
  Metadata:
    creation_time   : now
    encoder         : Lavf55.14.102
    Stream #0:0, 0, 1/1000000: Audio: mp3 (libmp3lame), 44100 Hz,
stereo, s32p, 128 kb/s
    Stream #0:1, 0, 1/1000000: Video: flv1 (flv), yuv420p, 720x480,
1001/30000, q=2-31, 768 kb/s, 1000k tbn, 29.97 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le -> libmp3lame)
  Stream #1:0 -> #0:1 (rawvideo -> flv)
Press [q] to stop, [?] for help
[alsa @ 0x1ad1ba0] ALSA buffer xrun.
*** 2 dup!
    Last message repeated 6 times
frame=   22 fps=0.0 q=12.4 size=     200kB time=00:00:00.99
bitrate=1653.7kbits*** 2 dup!drop=0
    Last message repeated 2 times
[alsa @ 0x1ad1ba0] ALSA buffer xrun.
*** 2 dup!
frame=   34 fps= 29 q=20.6 size=     252kB time=00:00:01.13
bitrate=1819.7kbits*** 2 dup!drop=0
    Last message repeated 5 times
frame=   52 fps= 30 q=20.0 size=     360kB time=00:00:02.04
bitrate=1440.8kbits*** 2 dup!drop=0
    Last message repeated 3 times
[alsa @ 0x1ad1ba0] ALSA buffer xrun.
frame=   64 fps= 28 q=21.5 size=     420kB time=00:00:02.13
bitrate=1611.2kbits*** 2 dup!drop=0
    Last message repeated 3 times
*** 1 dup!
frame=   79 fps= 28 q=19.5 size=     504kB time=00:00:03.18
bitrate=1295.0kbitsframe=   82 fps= 22 q=20.1 size=     544kB
time=00:00:03.18 bitrate=1397.8kbits[alsa @ 0x1ad1ba0] ALSA buffer
xrun.
*** 9 dup!
frame=  126 fps= 30 q=4.3 size=     696kB time=00:00:04.85
bitrate=1175.1kbits/frame=  132 fps= 28 q=5.8 size=     784kB
time=00:00:04.85 bitrate=1323.7kbits/[alsa @ 0x1ad1ba0] ALSA buffer
xrun.
frame=  158 fps= 30 q=10.1 size=     808kB time=00:00:05.27
bitrate=1255.5kbitsframe=  183 fps= 32 q=8.2 size=     888kB
time=00:00:06.14 bitrate=1183.3kbits/[alsa @ 0x1ad1ba0] ALSA buffer
xrun.
frame=  198 fps= 32 q=7.2 size=     924kB time=00:00:07.12
bitrate=1061.7kbits/frame=  203 fps= 30 q=8.6 size=     988kB
time=00:00:07.20 bitrate=1122.9kbits/[alsa @ 0x1ad1ba0] ALSA buffer
xrun.
frame=  224 fps= 30 q=18.1 size=    1080kB time=00:00:07.47
bitrate=1183.7kbitsframe=  246 fps= 31 q=5.9 size=    1152kB
time=00:00:08.71
...
snipped ~150 lines


More information about the ffmpeg-user mailing list