0

I want to scroll text from bottom to top.  I use the command:

ffmpeg -i test.mp4 -vf "drawtext=fontfile=tahoma.ttf:fontsize=40:fontcolor=green:x=(w-text_w)/2+20:y=h-40*t:text=Scroll.txt:bordercolor=white:borderw=2" -c:v libx264 -y -preset ultrafast scrolling.mp4

It scrolls from bottom to top, but I want to scroll from bottom to (top - 50px) only. (I get text from a file and multilines).

Tien
  • 23
  • 1
  • 4

1 Answers1

1

Quickest way to do this is to overlay the top 50 px of the original video onto the video with text.

Use

ffmpeg -i test.mp4 -filter_complex "[0]split[txt][orig];[txt]drawtext=fontfile=tahoma.ttf:fontsize=40:fontcolor=green:x=(w-text_w)/2+20:y=h-40*t:text=Scroll.txt:bordercolor=white:borderw=2[txt];[orig]crop=iw:50:0:0[orig];[txt][orig]overlay" -c:v libx264 -y -preset ultrafast scrolling.mp4
Gyan
  • 34,439
  • 6
  • 56
  • 98
  • When I tried this I got the error "No such filter: 'drawtext' How do you help ffmpeg locate the font file in Mac OS? – Tony M Dec 05 '20 at 12:12
  • 1
    If your ffmpeg build doesn't have drawtext filter then locating the font won't help. Get a full recent ffmpeg build from https://evermeet.cx/ffmpeg/ – Gyan Dec 05 '20 at 13:03
  • Thanks, Gyan, you are right -- I did need to update ffmpeg. Once I did, your solution did work on some test files. However, I'm still can't get scrolling text in my desired video using your (or other) methods. I keep getting "Too many packets buffered for output stream 0:1". My video is simply black screen with .wav sound made based on this post: https://superuser.com/a/1041820/752104 – Tony M Dec 06 '20 at 21:40
  • What's the exact command to create video? – Gyan Dec 07 '20 at 04:55
  • ffmpeg -r 1 -loop 1 -i m.jpg -i m.mp3 -acodec copy -r 1 -shortest -vf scale=1280:720 m.mov although I've also tried with m.wav -- by the way, I just want simple scrolling from bottom to top from a text file and found this post as I've been trying anything I could find. – Tony M Dec 07 '20 at 08:54
  • 1
    Remove `-r 1`.. – Gyan Dec 07 '20 at 10:08
  • -r 1 occurs twice, so I removed both -- and it worked! Thanks a lot! – Tony M Dec 07 '20 at 11:05