0

I am trying to create a video from single image and add a text on top. Command on Ubuntu:

ffmpeg -loop 1 -r 1 -i image.jpg -b:v 1M -vf scale=320:240 "drawtext=fontfile=/usr/share/fonts/truetype/DejaVuSans.ttf: text='Test Text'" -t 20 output.mp4

and I am getting this error:

    Unable to find a suitable output format for 'drawtext=fontfile=/usr/share/fonts/truetype/DejaVuSans.ttf: text='Test Text''
drawtext=fontfile=/usr/share/fonts/truetype/DejaVuSans.ttf: text='Test Text': Invalid argument

I need to keep the scale to 320:240

Not sure why this is happening.

Another issue is that when I add -loop 1 the command freezes for 5-7 seconds before proceeding to encode. This problem does not exist when there is no -loop 1

After this output -loop 1 freezes:

 ffmpeg version 2.3.git Copyright (c) 2000-2014 the FFmpeg developers
  built on Aug 14 2014 01:22:13 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
  configuration: --prefix=/home/user/ffmpeg_build --extra-cflags=-I/home/user/ffmpeg_build/include --extra-ldflags=-L/home/user/ffmpeg_build/lib --bindir=/home/user/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libfreetype --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-libfribidi --enable-libfontconfig
  libavutil      54.  1.100 / 54.  1.100
  libavcodec     56.  0.100 / 56.  0.100
  libavformat    56.  0.100 / 56.  0.100
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  0.100 /  5.  0.100
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  0.100 /  1.  0.100
  libpostproc    53.  0.100 / 53.  0.100

And then it proceeds to encode as usual. Weird.

1 Answer 1

2

The problem is that you just gave ffmpeg one filter, namely the scale one.

-vf scale=320:240 "drawtext=fontfile=/usr/share/fonts/truetype/DejaVuSans.ttf: text='Test Text'"

The "drawtext…" part is interpreted as the output file name, which it cannot open. If you have multiple filters to use, combine them with a comma:

-vf "scale=320:240, drawtext=fontfile=/usr/share/fonts/truetype/DejaVuSans.ttf: text='Test Text'"
4
  • This is working now. Do you have any idea about the -loop 1 related freeze? Thank you! Aug 14, 2014 at 19:08
  • No, sorry – I've never experienced that before and I cannot reproduce the issue.
    – slhck
    Aug 14, 2014 at 19:31
  • I see, either that is very helpful! Aug 14, 2014 at 19:34
  • nice one - that helped me just now! Apr 14, 2019 at 14:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .