[FFmpeg-user] Issue while burning text to a video , output is of hls and scaled

Moritz Barsnick barsnick at gmx.net
Wed Feb 24 20:37:10 CET 2016


Hi, Aameer,

On Wed, Feb 24, 2016 at 18:17:51 +0530, Aameer Rafiq Wani wrote:
> I have been scratch my head on this. Let me start with my objective which
> is:

I think you are a bit overambitious. You are very close to your
solutions, but keep going in the wrong direction.

Let me pick up your stackoverflow question
> http://stackoverflow.com/questions/35597083/how-to-build-ffmpeg-with-burn-text-on-hls-output-while-maintaining-the-aspect-ra
and point out where you went wrong.

> (ffmpeg)aameer at falcon:~/Documents/projects/ffmpeg$ ffmpeg -threads 4 -i "input_sintel_trailer_720p.mp4" -profile:v baseline -level 4.0 -vf scale="trunc(360*a/2)*2:360, subtitles='subtitles.srt'"  -start_number 0 -hls_time 10 -hls_list_size 0 -f hls videos/4444/index_4444_360_.m3u8
[...]
> [Parsed_subtitles_1 @ 0x2f1b7e0] Shaper: FriBidi 0.19.6 (SIMPLE) HarfBuzz-ng 0.9.27 (COMPLEX)
> [Parsed_subtitles_1 @ 0x2f1b7e0] Unable to open subtitles.srt
> [AVFilterGraph @ 0x2f1ac00] Error initializing filter 'subtitles' with args 'subtitles.srt'
> Error opening filters!

I think you ignored the very clear message: "Unable to open
subtitles.srt". That file probably just isn't there.

> [AVFilterGraph @ 0x2695c20] No such filter: 'drawtext:drawtext'
> Error opening filters!

That means the drawtext filter wasn't built into your ffmpeg binary. Check with
$ ffmpeg -filters

Did you have (lib)freetype-dev installed when you built ffmpeg?

> I tried a static build too [...]
> ffmpeg version N-63893-gc69defd Copyright (c) 2000-2014 the FFmpeg developers
>   built on Jul 16 2014 05:38:01 with gcc 4.6 (Debian 4.6.3-1)

Wow, that's old. Don't use that. ffmpeg's download page points to way
more recent static builds here:
http://johnvansickle.com/ffmpeg/

> (ffmpeg)aameer at falcon:~/Documents/projects/ffmpeg$ ./ffmpeg -threads 4 -i "input_sintel_trailer_720p.mp4" -profile:v baseline -level 4.0 -vf scale="trunc(360*a/2)*2:360, subtitles='subtitle.srt'"  -start_number 0 -hls_time 10 -hls_list_size 0 -f hls videos/4444/index_4444_360_.m3u8
[...]
> Could not write header for output file #0 (incorrect codec parameters ?): No such file or directory

"No such file or directory" tells me that the directory where you want
to place your output file videos/4444/index_4444_360_.m3u8 does not
exist. Do an "mkdir" first, like in your script.

And from one of your comments in that thread:
> gives me a syntax error:
> (ffmpeg)aameer at falcon:~/Documents/projects/ffmpeg$ ffmpeg -threads 4 -i "input_sintel_trailer_720p.mp4" -profile:v baseline -level 4.0 -vf "scale=-2:360,drawtext="fontfile=/path/to/font.ttf:fontcolor=white:fontsize=30:text='Your Text':x=(W-tw)/2:y=H-th-30"" -start_number 0 -hls_time 10 -hls_list_size 0 -f hls videos/4444/index_4444_360_.m3u8
> bash: syntax error near unexpected token `(' 

You have a quoting issue. E.g. you are using duplicate '"' marks, some
of those need to go away. I think instead of this:
  -vf "scale=-2:360,drawtext="fontfile=/path/to/font.ttf:fontcolor=white:fontsize=30:text='Your Text':x=(W-tw)/2:y=H-th-30""
you need this:
  -vf "scale=-2:360,drawtext=fontfile=/path/to/font.ttf:fontcolor=white:fontsize=30:text='Your Text':x=(W-tw)/2:y=H-th-30"


You see, you are tripping over very fundamental things. You need to
read those messages with more attention to detail.

Cheers,
Moritz


More information about the ffmpeg-user mailing list