[FFmpeg-user] Can't make video filter drawtext accept command from multi media filter zmq
Thomas Seilund
tps at netmaster.dk
Mon Jun 22 20:51:10 CEST 2015
Paul B Mahol writes:
> On 6/22/15, Thomas Seilund <tps at netmaster.dk> wrote:
>> Paul B Mahol writes:
>>
>>> On 6/22/15, Thomas Seilund <tps at netmaster.dk> wrote:
>>>> Hi All
>>>>
>>>> I always get error "38 Function not implemented" when I send command to
>>>> video filter drawtext.
>>>>
>>>> Here is the command I run and the result I get:
>>>>
>>>> tps at t420:~/video/test$ echo Parsed_drawtext_1 text AA |
>>>> /home/tps/data/data/ffmpeg/tools/zmqsend -b tcp://127.0.0.1:5557
>>>> 38 Function not implemented
>>>> tps at t420:~/video/test$
>>>>
>>>> I run the command while I have this ffmpeg instance running:
>>>>
>>>> tps at t420:~/video/test$ ffmpeg -loop 1 -i test.png -filter_complex
>>>> "zmq=bind_address=tcp\\\://127.0.0.1\\\:
>>>> 5557,drawtext=text=AA:x=50:y=50:fontfile=/usr/share/fonts/truetype/freefont/
>>>>
>>>> FreeMonoBold.ttf" -f mpegts -c libx264 test.ts
>>>> ffmpeg version N-69238-g2699a37 Copyright (c) 2000-2015 the FFmpeg
>>>> developers
>>>> built on Apr 23 2015 17:10:30 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
>>>> configuration: --enable-gpl --enable-libmp3lame --enable-libvpx
>>>> --enable-
>>>>
>>>> libx264 --enable-version3 --enable-libvorbis --enable-libfreetype
>>>> --enable-
>>>>
>>>> libv4l2 --enable-libfdk-aac --enable-nonfree --enable-libpulse --enable-
>>>> libzmq
>>>> libavutil 54. 17.100 / 54. 17.100
>>>> libavcodec 56. 20.100 / 56. 20.100
>>>> libavformat 56. 19.100 / 56. 19.100
>>>> libavdevice 56. 4.100 / 56. 4.100
>>>> libavfilter 5. 8.101 / 5. 8.101
>>>> libswscale 3. 1.101 / 3. 1.101
>>>> libswresample 1. 1.100 / 1. 1.100
>>>> libpostproc 53. 3.100 / 53. 3.100
>>>> Input #0, png_pipe, from 'scoreboard.png':
>>>> Duration: N/A, bitrate: N/A
>>>> Stream #0:0: Video: png, pal8, 200x100 [SAR 72:72 DAR 2:1], 25 fps,
>>>> 25
>>>>
>>>> tbr, 25 tbn, 25 tbc
>>>> File 'test.ts' already exists. Overwrite ? [y/N] y
>>>> No pixel format specified, yuv444p for H.264 encoding chosen.
>>>> Use -pix_fmt yuv420p for compatibility with outdated media players.
>>>> [libx264 @ 0x2d2c4c0] using SAR=1/1
>>>> [libx264 @ 0x2d2c4c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
>>>> AVX
>>>> [libx264 @ 0x2d2c4c0] profile High 4:4:4 Predictive, level 1.1, 4:4:4
>>>> 8-bit
>>>> Output #0, mpegts, to 'test.ts':
>>>> Metadata:
>>>> encoder : Lavf56.19.100
>>>> Stream #0:0: Video: h264 (libx264), yuv444p, 200x100 [SAR 1:1 DAR
>>>> 2:1],
>>>>
>>>> q=-1--1, 25 fps, 90k tbn, 25 tbc
>>>> Metadata:
>>>> encoder : Lavc56.20.100 libx264
>>>> Stream mapping:
>>>> Stream #0:0 (png) -> zmq
>>>> drawtext -> Stream #0:0 (libx264)
>>>> Press [q] to stop, [?] for help
>>>> frame=14512 fps=1948 q=-1.0 Lsize= 2947kB time=00:09:40.40 bitrate=
>>>> 41.6kbits/s
>>>> video:351kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
>>>> muxing overhead: 739.239502%
>>>>
>>>>
>>>>
>>>> Any help would be very much appreciated
>>>
>>> Looking at code command must be reinit and args are normal args you
>>> usual give to drawtext filter.
>>>
>>> But example with drawtext and zmq should really be added to docs.
>>>
>>>>
>>>> Thanks
>>>>
>>>> Thomas S
>>>> _______________________________________________
>>>> ffmpeg-user mailing list
>>>> ffmpeg-user at ffmpeg.org
>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>>>
>>> _______________________________________________
>>> ffmpeg-user mailing list
>>> ffmpeg-user at ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>>
>> Hi Paul,
>>
>> Thanks a lot - it works - but it is slow !!
>>
>> Now I run ffmpeg and pipe to ffplay to see the effect of the command.
>>
>> I run this ffmpeg command:
>>
>> tps at t420:~/video/test$ ffmpeg -loglevel debug -loop 1 -i test.png -
>> filter_complex "zmq=bind_address=tcp\\\://127.0.0.1\\\:
>> 5557,drawtext=text=XX:x=50:y=50:fontfile=/usr/share/fonts/truetype/freefont/
>>
>> FreeMonoBold.ttf" -f mpegts -c libx264 - | ffplay -i -
>>
>> And I run this command to change the drawtext filter:
>>
>> tps at t420:~/video/test$ echo Parsed_drawtext_1 reinit text=CC |
>> /home/tps/data/data/ffmpeg/tools/zmqsend -b tcp://127.0.0.1:5557
>>
>> There is a delay of 10+ seconds from I run the command until I see the
>> effect in ffplay.
>>
>> I had hoped for instant effect - can I do something to get instant effect ?
>
> Perhaps encoding and drawing text is not realtime at all? Try encoding
> with -preset ultrafast
>>
>> Thanks for you help
>>
>> Thomas S
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Hi Paul
Now I use -preset ultrafast and -re to encode real time.
Here is the command:
ffmpeg -re -y -loop 1 -i test.png -filter_complex
"zmq=bind_address=tcp\\\://127.0.0.1\\\:
5557,drawtext=text=XX:x=50:y=50:fontfile=/usr/share/fonts/truetype/freefont/
FreeMonoBold.ttf" -f mpegts -c libx264 -preset ultrafast test.ts
As the ffmpeg command run I can see the number of seconds encoded.
When that number reaches 10 seconds I run the command:
echo Parsed_drawtext_1 reinit text=CC |
/home/tps/data/data/ffmpeg/tools/zmqsend -b tcp://127.0.0.1:5557
Then I let the ffmpeg command run 10 seconds more.
When I replay the encoded file with ffplay I see the number of seconds
replayed.
I expected to see new text from the drawtext filter after 10 seconds but
the change did not occur until 12 seconds had passed - that is 2 seconds
later that expected.
Perhaps your right - it is not a real time event ?
Thanks
Thomas S
More information about the ffmpeg-user
mailing list