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

Alex Morris axman.5389 at gmail.com
Fri Sep 6 22:08:06 CEST 2013


>> ffmpeg version 2.0
>
> Please test current git head.
>
> Carl Eugen

Hi Carl,

Thanks for the response.

I've recompiled using git version from Sept 6, 2013, fetched this
morning.  Symptoms are different, but not better..  Output of video +
drawtext overlay to flv file still works correctly.  ffplay handles it
no problem.

Output of flv to a stream appears to process 3 frames, then stops silently.

One thing to add, maybe it helps.  I specify audio input and output in
my ffmpeg command because the GoPro device has an audio signal
available.  But in fact, there is no audio signal physically connected
to the v4l capture device - I am only using video right now.  I
mention it only because of seeing "ALSA buffer xrun" messages..

Kind regards,
alex

====
Complete, uncut console command:

ajm at bozo:~/scripts$ /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
ffmpeg version N-56075-g898c619 Copyright (c) 2000-2013 the FFmpeg developers
  built on Sep  6 2013 11:37:28 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. 43.100 / 52. 43.100
  libavcodec     55. 31.101 / 55. 31.101
  libavformat    55. 16.101 / 55. 16.101
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 84.100 /  3. 84.100
  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/test.flv' ... 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 @ 0x22deba0] All info found
Input #0, alsa, from 'hw:0':
  Duration: N/A, start: 1378496421.742718, 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 @ 0x22f05c0] fd:4 capabilities:5030011
[video4linux2,v4l2 @ 0x22f05c0] Selecting input_channel: 1
[video4linux2,v4l2 @ 0x22f05c0] Current input_channel: 1, input_name: Composite
[video4linux2,v4l2 @ 0x22f05c0] Querying the device for the current frame size
[video4linux2,v4l2 @ 0x22f05c0] Setting frame size to 720x480
[video4linux2,v4l2 @ 0x22f05c0] The V4L2 driver is using the interlaced mode
[video4linux2,v4l2 @ 0x22f05c0] Current standard: NTSC-M, id: 4096,
frameperiod: 1001/30000
[video4linux2,v4l2 @ 0x22f05c0] All info found
Input #1, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 1378496422.349679, 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/test.flv.
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/test.flv.
Successfully opened the file.
detected 4 logical cores
[Parsed_drawtext_0 @ 0x22f51e0] Setting 'fontfile' to value
'/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf'
[Parsed_drawtext_0 @ 0x22f51e0] Setting 'text' to value '%{localtime:%F_%T}'
[Parsed_drawtext_0 @ 0x22f51e0] Setting 'x' to value '20'
[Parsed_drawtext_0 @ 0x22f51e0] Setting 'y' to value '20'
[Parsed_drawtext_0 @ 0x22f51e0] Setting 'fontsize' to value '24'
[Parsed_drawtext_0 @ 0x22f51e0] Setting 'fontcolor' to value 'green'
[Parsed_drawtext_0 @ 0x22f51e0] Setting 'fontsize' to value '24'
[graph 0 input from stream 1:0 @ 0x22d6d20] Setting 'video_size' to
value '720x480'
[graph 0 input from stream 1:0 @ 0x22d6d20] Setting 'pix_fmt' to value '17'
[graph 0 input from stream 1:0 @ 0x22d6d20] Setting 'time_base' to
value '1/1000000'
[graph 0 input from stream 1:0 @ 0x22d6d20] Setting 'pixel_aspect' to
value '0/1'
[graph 0 input from stream 1:0 @ 0x22d6d20] Setting 'sws_param' to
value 'flags=2'
[graph 0 input from stream 1:0 @ 0x22d6d20] Setting 'frame_rate' to
value '30000/1001'
[graph 0 input from stream 1:0 @ 0x22d6d20] w:720 h:480 pixfmt:uyvy422
tb:1/1000000 fr:30000/1001 sar:0/1 sws_param:flags=2
[scaler for output stream 0:0 @ 0x22cee60] Setting 'w' to value '720'
[scaler for output stream 0:0 @ 0x22cee60] Setting 'h' to value '480'
[scaler for output stream 0:0 @ 0x22cee60] Setting 'flags' to value '0x4'
[scaler for output stream 0:0 @ 0x22cee60] w:720 h:480 flags:'0x4' interl:0
[format @ 0x22cd700] compat: called with args=[yuv420p]
[format @ 0x22cd700] Setting 'pix_fmts' to value 'yuv420p'
[auto-inserted scaler 0 @ 0x22cec60] Setting 'flags' to value '0x4'
[auto-inserted scaler 0 @ 0x22cec60] w:iw h:ih flags:'0x4' interl:0
[Parsed_drawtext_0 @ 0x22f51e0] auto-inserting filter 'auto-inserted
scaler 0' between the filter 'graph 0 input from stream 1:0' and the
filter 'Parsed_drawtext_0'
[AVFilterGraph @ 0x22f8700] query_formats: 5 queried, 3 merged, 1
already done, 0 delayed
[auto-inserted scaler 0 @ 0x22cec60] picking yuv422p out of 27
ref:uyvy422 alpha:0
[auto-inserted scaler 0 @ 0x22cec60] w:720 h:480 fmt:uyvy422 sar:0/1
-> w:720 h:480 fmt:yuv422p sar:0/1 flags:0x4
[scaler for output stream 0:0 @ 0x22cee60] w:720 h:480 fmt:yuv422p
sar:0/1 -> w:720 h:480 fmt:yuv420p sar:0/1 flags:0x4
[graph 1 input from stream 0:0 @ 0x231dc80] Setting 'time_base' to
value '1/48000'
[graph 1 input from stream 0:0 @ 0x231dc80] Setting 'sample_rate' to
value '48000'
[graph 1 input from stream 0:0 @ 0x231dc80] Setting 'sample_fmt' to value 's16'
[graph 1 input from stream 0:0 @ 0x231dc80] Setting 'channel_layout'
to value '0x3'
[graph 1 input from stream 0:0 @ 0x231dc80] tb:1/48000 samplefmt:s16
samplerate:48000 chlayout:0x3
[audio format for output stream 0:1 @ 0x231df40] Setting 'sample_fmts'
to value 's32p|fltp|s16p'
[audio format for output stream 0:1 @ 0x231df40] Setting
'sample_rates' to value '44100'
[audio format for output stream 0:1 @ 0x231df40] Setting
'channel_layouts' to value '0x3'
[audio format for output stream 0:1 @ 0x231df40] auto-inserting filter
'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and
the filter 'audio format for output stream 0:1'
[AVFilterGraph @ 0x22de4c0] query_formats: 4 queried, 6 merged, 3
already done, 0 delayed
[auto-inserted resampler 0 @ 0x23212a0] ch:2 chl:stereo fmt:s16
r:48000Hz -> ch:2 chl:stereo fmt:s16p r:44100Hz
[flv @ 0x22f3c20] intra_quant_bias = 0 inter_quant_bias = -64
Output #0, flv, to 'http://192.168.1.105:8092/test.flv':
  Metadata:
    encoder         : Lavf55.16.101
    Stream #0:0, 0, 1/1000: Video: flv1 (flv) ([2][0][0][0] / 0x0002),
yuv420p, 720x480, 1/30, q=2-31, 768 kb/s, 1k tbn, 30 tbc
    Stream #0:1, 0, 1/1000: Audio: mp3 (libmp3lame) ([2][0][0][0] /
0x0002), 44100 Hz, stereo, s16p, 128 kb/s
Stream mapping:
  Stream #1:0 -> #0:0 (rawvideo -> flv)
  Stream #0:0 -> #0:1 (pcm_s16le -> libmp3lame)
Press [q] to stop, [?] for help
[alsa @ 0x22deba0] ALSA buffer xrun.
[Parsed_drawtext_0 @ 0x22f51e0] n:0 t:0.000000 text_w:290 text_h:24 x:20 y:20
[Parsed_drawtext_0 @ 0x22f51e0] n:1 t:0.032054 text_w:290 text_h:24 x:20 y:20
[Parsed_drawtext_0 @ 0x22f51e0] n:2 t:0.064112 text_w:290 text_h:24 x:20 y:20


More information about the ffmpeg-user mailing list