FORUMS: list search recent posts

Convert SubRip to drawtext (source code included)

COW Forums : FFmpeg

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Chiq Garcia
Convert SubRip to drawtext (source code included)
on Mar 20, 2014 at 5:37:43 am

I haven't had much luck with burning in subtitles using ffmpeg's subtitles filter, so I wrote this tiny Windows CLI app that I would like to share with anyone interested.

The app's name is 'srtdrawtext' and it takes SubRip subtitles (*.srt) as input and outputs a text file containing drawtext commands which ffmpeg (or ffplay) can read via the sendcmd filter. The generated text file basically tells ffmpeg what text to draw and when to draw it. While this method may seem 'desperate', this may also prove to be the easiest way to burn-in subtitles.

srtdrawtext (~300 kb) is absolutely free and includes the manual and the source code (210 lines, *.au3) which you can modify/distribute (due credit would be nice). Instructions on how to use the generated text file will be written on the file itself. An example:

ffplay -vf "sendcmd=filename='C\:\\srtdrawtext_output.txt', drawtext=fontfile='C\:\\Windows\\Fonts\\tahoma.ttf': fontcolor=yellow: fontsize=18: box=1: boxcolor=0x000000@0xA5: x=(w-text_w)*0.5: y=(h-text_h-line_h)*1: text=''" -autoexit -framedrop "C:\Movies\Tinimbang_ka_ngunit_kulang_(1974).avi"

download link:
http://www.mediafire.com/download/epxnpnq39v413hv/srtdrawtext.zip


Return to posts index

Lou Logan
Re: Convert SubRip to drawtext (source code included)
on Mar 20, 2014 at 5:42:16 pm

Interesting concept and thanks for sharing.

What were the limitations of the subtitles filter?


Return to posts index

Chiq Garcia
Re: Convert SubRip to drawtext (source code included)
on Mar 21, 2014 at 12:05:00 am
Last Edited By Chiq Garcia on Mar 21, 2014 at 2:39:40 am

Oh I didn't set out to address some sort of limitation with the subtitles filter, and I'm sure everyone else is doing fine with it (on Linux?). But, I'm afraid I can't give you a good or adequate/qualified answer, except for: I can't get it to work (I'm embarrassed actually).

I remember seeing video conversion apps with ffmpeg as main back-end, but relegating subtitle-burning-in tasks to ?mencoder? which I do not like.

Anyway, I'm on Windows XP using ffmpeg-20140226-git-96fc290-win32-static. I seem to recall seeing on the log file: 'neither playresx nor playresy defined', reverting to 384 x some other number, a bunch of subtitle-related stuff which seemed to indicate that it can manage and everything is okay, but no subs for me. I've given up on this a long time ago (sorry I couldn't give a detailed answer). I'm not complaining, though, it just so happens that an alternative (sendcmd & drawtext) exists in ffmpeg. Just another way to skin a cat, I suppose (for those having trouble doing it the proper way).


Return to posts index


Chiq Garcia
Re: Convert SubRip to drawtext (source code included)
on Mar 21, 2014 at 12:27:02 am

Oh, btw, while you're here, I wrote an ffmpeg gui with a video filter cheat sheet which has an entry with your name on it (color curves). Do you approve? If not, I will amend on next release (internet connectivity is such a precious commodity in a third-world country).

http://tinypic.com/r/2narvw2/8


Return to posts index

Lou Logan
Re: Convert SubRip to drawtext (source code included)
on Mar 22, 2014 at 5:55:19 pm

Thanks for asking, but with or without my name is fine with me. Whatever you prefer.


Return to posts index

Chiq Garcia
Re: Convert SubRip to drawtext (source code included)
on Jun 5, 2014 at 6:31:26 pm

link update:

http://www.mediafire.com/download/3is5jc5v851h274/srtdrawtext_2014.05.26.zi...

With a few samples on hand, I proceeded to coding srtdrawtext without googling SubRip specifications (oops!). As stated on the manual, HTML tags in the *.srt file will be stripped.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]