While the method may seem 'desperate', this may also prove to be the easiest way to burn-in subtitles (*.srt). It seems to me that any thread on any forum about burning in subs with ffmpeg appears to be silent. The lack of eureka's and heartfelt thank-you's only confirms one's suspicion that the thread topic is unresolved. In weary resignation, I have concluded that: "It's just me... and everyone else can do it."
Reading up on the somewhat cryptic ffmpeg documentation, I learned that the drawtext filter may probably be only good for PTS, timecode, and single-line text. The proverbial lightbulb somehow flickered when I came upon the sendcmd filter. Hmmm... I imagined hearing the sound of rusty gears slowly turning in my head. The quietest most hesitant 'eureka' in the history of mankind may have escaped my lips. Uhh no, I didn't actually say 'eureka', because I'm Filipino, and we don't talk like that, but you get my drift.
After some quick tests, the verdict was out: All one has to do is create a sendcmd file (*.txt) containing all the drawtext commands telling ffmpeg what text to draw and when to draw it. It's quite simple really!
The idea is to change this:
1
00:00:19,420 --> 00:00:23,090
A SERBIAN FILM
into this:
00:00:19.420-00:00:23.090 [enter] drawtext reinit text='A SERBIAN FILM', [leave] drawtext reinit text='';
With less than 300 lines of code (AutoIt), I have managed to convert an *.srt file into a text file that could boss around ffmpeg.
This is my eureka moment I want to share with anyone who has lost a good amount of hair trying to figure out how to burn-in those d*mn subtitles.
This tiny app (absolutely free) for Windows is about 641 kb (includes the CLI executable, a GUI, and source code) and you can download it here:
updated: 2014.05.26
http://www.mediafire.com/download/3is5jc5v851h274/srtdrawtext_2014.05.26.zip
An easier-to-use version that works in conjunction with VidProk (included in 'VidProkEnMasse' which is also absolutely free) can be downloaded here: http://vidprokenmasse.blogspot.com/
Update 2014.05.26:
Yeah, I made a boo-boo... I didn't bother googling SubRip specifications prior to coding with a handful of SubRip files as samples (hehehe oops!).
VidProkEnMasse is an all-ffmpeg solution for your daily video encoding needs. "VidProk" processes videos 'piece-meal' while "En Masse" batch processes videos (last tested on 1849 files).
Monday, July 14, 2014
VidProkEnMasse
VidProkEnMasse is an all-ffmpeg solution for your daily video encoding needs. The name is derived from its two major apps in the collection. "VidProk" processes videos 'piece-meal' while "En Masse" batch processes videos (last tested on 1849 files).
Apart from their intended use, VidProk and En Masse are also excellent learning tools for new ffmpeg users as both apps readily reveal their ffmpeg 'recipes'. While the GUI provides convenience for experienced ffmpeg users, you don't have to be an ffmpeg guru to use VidProkEnMasse. It does not include a large collection of device-specific presets, but it fairly outlines some of ffmpeg's vast capabilities. You can consider the example presets as a sort of walk-through.
VidProkEnMasse is a home-brew solution created by a frustrated end-user for other end-users. It does not write to the registry, does not automatically 'phone home' for updates, does not nag, does not coerce your browser to a new home page/search engine or to install a new toolbar, and does not require you to join a cult. VidProkEnMasse is absolutely free, though small donations are very much welcome. Email me: chiqboy<[at]>gmail<[dot]>com
En Masse features:
1. Easy operation: Select preset, select folder, generate batch file, convert.
2. The usual features: Burn-in *.srt (SubRip) subtitle files, single-/two-pass encoding, crf-/quantizer-/bitrate-based encoding, generate video statistics logs, shutdown after encoding, etc.
3. Logged encodes: Elapsed time, render speed, rendered file size, possible failed encode, etc.
4. Preset Manager - Bitrate-based encodes: Integrated qf calculator. Max duration on DVD-5/-9. Resize all videos to one width or depending on aspect ratio, or no resize at all (square pixel/anamorphic).
5. Queue Stats readily displays total number of files/size, total duration, and estimated total output size (if available).
6. Integrated bitrate calculator (Duration/x). Suggests video bitrate based on total video duration (as on Queue Stats) and the number of discs you specify.
7. Text expansion support (%variables%).
VidProk features:
1. Easy operation: Drag/drop video, select preset, add video filters, tweak, preview, encode.
2. The usual features: Burn-in *.srt (SubRip) subtitle files, single-/two-pass encoding, crf-/quantizer-/bitrate-based encoding, extract frames to jpg files, extract screen shots, extract embedded subtitles to srt, extract audio to wav, change container or discard/copy stream, generate video statistics logs, crop/scale/distort frames, select/tweak/preview video filters, etc.
3. Logged encodes: Elapsed time, render speed, rendered file size, possible failed encode, etc.
4. Text expansion support (%variables%).
5. Unique feature: LAP (low, average, peak). Answers the question: 'What's the peak video birate like if I were to encode with XYZ settings?'.
Some of the other tools included:
GetTotalDuration.exe: Computes total and average duration of dragged/dropped video files.
JoinAVstreams.exe: Stream copy/mux. May fix generally faulty videos or some rogue mkv files (variable frame rate with missing frame count).
AnalyzeVstatsLogFile.exe: Similar to "LAP". Reads ffmpeg-generated video statistics logs and retrieves low/average/peak q, low/average/peak bitrate, etc. Ever wondered what the bitrate is like for T.V. noise?
En Masse demo:
https://www.youtube.com/watch?v=6pSH8lQZpRQ
Download VidProkEnMasse:
Click Here
Update: VidProkEnMasse_20170116
1. Modified scale routine: If Width combo boxes are left blank, no scale filter will be applied. I was compelled to implement this when I processed videos from a smart phone (annoying "portrait" videos).
2. Added "SRTFix.exe" (GUI) and "SRTFixCLI.exe" (command line). Both attempt to fix subtitles (*.srt) with long lines that go right off the screen. Limits subtitles to two rows when max characters is exceeded.
3. Added "GaugeVideoGenerator.exe". Default settings attempt to replicate the visual content (bitrate-wise) of "Transformers - Age of Extinction (2014)"... shortened to 100 seconds. Lets the user guesstimate output file size of crf-/quantizer-based encodes. Said movie, AFAIK, has the highest bitrate for a feature film. May answer the silly question: "What is the equivalent bitrate of crf 23?"
4. Added %presetdetails% to text expansion. Useful when used on metadata comment.
%presetdetails% expands to:
PresetName: V/A codec: vc+ac. V/A bitrate: vb+ab. fps: x. Widths: a, b, c, d. PIFA: xyz. VFA1: xyz. VFA2: xyz. PvfFFA: xyz.
5. Added %loud% to text expansion which makes audio output significantly louder
%loud% expands to:
-af "aformat=channel_layouts=stereo, compand=0 0:1 1:-72/-72 -48/-6 -3/-3 24/-3:0.01:0:-96:0"
6. Updated to "ffmpeg-20160116-git-d7c75a5-win32-static" which works on my OS (Windows XP 32-bit). Please feel free to replace with the latest ffmpeg Zeranoe static build if desired/required.
7. Unfortunately, VidProkEnMasse, being written in AutoIt, still suffers false positives from lazy AV software companies :\
Update: VidProkEnMasse_20140714
1. Renamed app to 'VidProkEnMasse'.
2. Added text expansion feature (%variables%).
3. Added 'AnalyzeVstatsLogFile.exe' which retrieves info (like peak q, peak bitrate, etc) from vstats log files.
4. VidProk: Added 'LAP' (Low, Average, Peak) which performs video statistics gathering and retrieves info similar to 'AnalyzeVstatsLogFile.exe'.
5. Added 'Longest.Line.In.Srt_[DROP.SRT.FILE.HERE].exe'.
6. Numerous tweaks.
7. Updated to ffmpeg-20140712-git-ca671be-win32-static.
8. Moved site to http://vidprokenmasse.blogspot.com/2014/07/vidprokenmasse.html
Update: EnMasse_20140528
1. Dropped MediaInfo in favor of ffprobe (En Masse is now an ALL-ffmpeg solution).
2. En Masse: Burn-in subtitles (batch mode).
3. New policy: Maintain anamorphic dimensions if not resized.
4. Two-pass encoding.
5. VidProk encoding is now logged.
6. Numerous tweaks.
7. Updated to ffmpeg-20140502-git-0f9f24c-win32-static.
Apart from their intended use, VidProk and En Masse are also excellent learning tools for new ffmpeg users as both apps readily reveal their ffmpeg 'recipes'. While the GUI provides convenience for experienced ffmpeg users, you don't have to be an ffmpeg guru to use VidProkEnMasse. It does not include a large collection of device-specific presets, but it fairly outlines some of ffmpeg's vast capabilities. You can consider the example presets as a sort of walk-through.
VidProkEnMasse is a home-brew solution created by a frustrated end-user for other end-users. It does not write to the registry, does not automatically 'phone home' for updates, does not nag, does not coerce your browser to a new home page/search engine or to install a new toolbar, and does not require you to join a cult. VidProkEnMasse is absolutely free, though small donations are very much welcome. Email me: chiqboy<[at]>gmail<[dot]>com
En Masse features:
1. Easy operation: Select preset, select folder, generate batch file, convert.
2. The usual features: Burn-in *.srt (SubRip) subtitle files, single-/two-pass encoding, crf-/quantizer-/bitrate-based encoding, generate video statistics logs, shutdown after encoding, etc.
3. Logged encodes: Elapsed time, render speed, rendered file size, possible failed encode, etc.
4. Preset Manager - Bitrate-based encodes: Integrated qf calculator. Max duration on DVD-5/-9. Resize all videos to one width or depending on aspect ratio, or no resize at all (square pixel/anamorphic).
5. Queue Stats readily displays total number of files/size, total duration, and estimated total output size (if available).
6. Integrated bitrate calculator (Duration/x). Suggests video bitrate based on total video duration (as on Queue Stats) and the number of discs you specify.
7. Text expansion support (%variables%).
VidProk features:
1. Easy operation: Drag/drop video, select preset, add video filters, tweak, preview, encode.
2. The usual features: Burn-in *.srt (SubRip) subtitle files, single-/two-pass encoding, crf-/quantizer-/bitrate-based encoding, extract frames to jpg files, extract screen shots, extract embedded subtitles to srt, extract audio to wav, change container or discard/copy stream, generate video statistics logs, crop/scale/distort frames, select/tweak/preview video filters, etc.
3. Logged encodes: Elapsed time, render speed, rendered file size, possible failed encode, etc.
4. Text expansion support (%variables%).
5. Unique feature: LAP (low, average, peak). Answers the question: 'What's the peak video birate like if I were to encode with XYZ settings?'.
Some of the other tools included:
GetTotalDuration.exe: Computes total and average duration of dragged/dropped video files.
JoinAVstreams.exe: Stream copy/mux. May fix generally faulty videos or some rogue mkv files (variable frame rate with missing frame count).
AnalyzeVstatsLogFile.exe: Similar to "LAP". Reads ffmpeg-generated video statistics logs and retrieves low/average/peak q, low/average/peak bitrate, etc. Ever wondered what the bitrate is like for T.V. noise?
En Masse demo:
https://www.youtube.com/watch?v=6pSH8lQZpRQ
Download VidProkEnMasse:
Click Here
Update: VidProkEnMasse_20170116
1. Modified scale routine: If Width combo boxes are left blank, no scale filter will be applied. I was compelled to implement this when I processed videos from a smart phone (annoying "portrait" videos).
2. Added "SRTFix.exe" (GUI) and "SRTFixCLI.exe" (command line). Both attempt to fix subtitles (*.srt) with long lines that go right off the screen. Limits subtitles to two rows when max characters is exceeded.
3. Added "GaugeVideoGenerator.exe". Default settings attempt to replicate the visual content (bitrate-wise) of "Transformers - Age of Extinction (2014)"... shortened to 100 seconds. Lets the user guesstimate output file size of crf-/quantizer-based encodes. Said movie, AFAIK, has the highest bitrate for a feature film. May answer the silly question: "What is the equivalent bitrate of crf 23?"
4. Added %presetdetails% to text expansion. Useful when used on metadata comment.
%presetdetails% expands to:
PresetName: V/A codec: vc+ac. V/A bitrate: vb+ab. fps: x. Widths: a, b, c, d. PIFA: xyz. VFA1: xyz. VFA2: xyz. PvfFFA: xyz.
5. Added %loud% to text expansion which makes audio output significantly louder
%loud% expands to:
-af "aformat=channel_layouts=stereo, compand=0 0:1 1:-72/-72 -48/-6 -3/-3 24/-3:0.01:0:-96:0"
6. Updated to "ffmpeg-20160116-git-d7c75a5-win32-static" which works on my OS (Windows XP 32-bit). Please feel free to replace with the latest ffmpeg Zeranoe static build if desired/required.
7. Unfortunately, VidProkEnMasse, being written in AutoIt, still suffers false positives from lazy AV software companies :\
Update: VidProkEnMasse_20140714
1. Renamed app to 'VidProkEnMasse'.
2. Added text expansion feature (%variables%).
3. Added 'AnalyzeVstatsLogFile.exe' which retrieves info (like peak q, peak bitrate, etc) from vstats log files.
4. VidProk: Added 'LAP' (Low, Average, Peak) which performs video statistics gathering and retrieves info similar to 'AnalyzeVstatsLogFile.exe'.
5. Added 'Longest.Line.In.Srt_[DROP.SRT.FILE.HERE].exe'.
6. Numerous tweaks.
7. Updated to ffmpeg-20140712-git-ca671be-win32-static.
8. Moved site to http://vidprokenmasse.blogspot.com/2014/07/vidprokenmasse.html
Update: EnMasse_20140528
1. Dropped MediaInfo in favor of ffprobe (En Masse is now an ALL-ffmpeg solution).
2. En Masse: Burn-in subtitles (batch mode).
3. New policy: Maintain anamorphic dimensions if not resized.
4. Two-pass encoding.
5. VidProk encoding is now logged.
6. Numerous tweaks.
7. Updated to ffmpeg-20140502-git-0f9f24c-win32-static.
Labels:
autoit,
batch,
conversion,
En Masse,
ffmpeg,
free,
gui,
koda,
videos,
VidProk,
VidProkEnMasse
Subscribe to:
Comments (Atom)