BURN IN SUBS

Questions and answers on how to get the most out of FFAStrans
backlight
Posts: 44
Joined: Wed Dec 12, 2018 8:33 am

Re: BURN IN SUBS

Post by backlight »

Hi emcodem,
is not so simple, is not an "overriding" of the main style, but the size problem.
Let me explain better. We produce and burn subtitles using normally editing software as Premiere or Resolve...
We frequently burn subtitles in 1920x1080 files of movies post productied in 2.39:1.
The result of the encoding of the subs is that they appears in the letterboxing bars but we prefer that they remain on the image.
There is not a value for that. In fact also handbrake "crop" the image.
I created two script using handbrake and it works fine.

The real difference with ffmpeg is that I can encode also PRORES files.

If a customer gave me a prores 2.39 and wants back the same file... I need to use three passes...
CROP.. APPLY SUBS... ENCODE ADDING BARS so it gives me back the same file with burns on the image....

Very complicated!
emcodem
Posts: 1749
Joined: Wed Sep 19, 2018 8:11 am

Re: BURN IN SUBS

Post by emcodem »

Hi,
unfortunately i still don't get it, maybe it is best if you second your thoughts with pictures, how it is by default and how you want it to be.
Do you "crop" only as a workaround to get the subtitles in the right place?

cheers,
emcodem
emcodem, wrapping since 2009 you got the rhyme?
admin
Site Admin
Posts: 1680
Joined: Sat Feb 08, 2014 10:39 pm

Re: BURN IN SUBS

Post by admin »

Backlight, would it not be easier if you exported and shared your workflow? I can't see that you have done that.

-steinar
backlight
Posts: 44
Joined: Wed Dec 12, 2018 8:33 am

Re: BURN IN SUBS

Post by backlight »

Thank you for your help... but I think that you are consufing about style and burn in size. If you force style you are overriding ALL the parameters set in an SRT ot ASS file... those two files , for example, contains style for alignment, color and font.... they need to remain the same but using a "smaller" vertical area so it will not burn on the black bars. Tle Alignments are in 9 positions... now think about the most used two: CENTER BOTTOM, and CENTER TOP. The use the whole image as reference... I would like to burn it using a new vertical alignment as you can do with subtitling software. the workaround is to crop the image before burn in... as used by Handbrake.

This could by my GOAL!
emcodem
Posts: 1749
Joined: Wed Sep 19, 2018 8:11 am

Re: BURN IN SUBS

Post by emcodem »

Hey backlight,

i guess there are many ways to get to your goal. I'll suggest yet another one: using a transparent overlay with same widht but limited height.
Notice the escaping needs to be doubled, e.g. \\ before : and 4 backslashes to create actually one backslash.
Also notice i believe that you need to use the commandline processor instead of custom ffmpeg node for this as you have multiple -i .

Here some working example:

Code: Select all

ffmpeg -i Z:\test.mxf -f lavfi -i "color=white@0.0:size=1920x800,format=rgba,subtitles=C\\:\\\\Users\\\\emcodem\\\\Desktop\\\\test.ass:alpha=1" -filter_complex "[0:v][1:v]overlay" c:\temp\out.mp4
Please dont forget, an export of your current workflow and picutres of before and after were requested, it would be good if you provided those.

cheers!
emcodem
Last edited by emcodem on Fri Jul 19, 2019 9:13 am, edited 1 time in total.
emcodem, wrapping since 2009 you got the rhyme?
backlight
Posts: 44
Joined: Wed Dec 12, 2018 8:33 am

Re: BURN IN SUBS

Post by backlight »

Great emcodem,
i tested your script... it encodes but it never quit the encoding producing a "neverending" clip longer than the original one...
but the problem is that the ovelray subs ar alignet on top... we need on center... i'm testing a newer one.

in attachment my actual workflow
Attachments
HARDCODING_SUBS.xml
(14.17 KiB) Downloaded 473 times
backlight
Posts: 44
Joined: Wed Dec 12, 2018 8:33 am

Re: BURN IN SUBS

Post by backlight »

i found this working script...
c:\FFastrans0.9.4\Processors\ffmpeg\x64\ffmpeg.exe -i c:\subs\AXL_001.mov -f lavfi -i "color=white@0.0:size=1920x800,format=rgba,subtitles=C\\:\\\\subs\\\\AXL_001.srt:alpha=1" -filter_complex "overlay=(W-w)/2:(H-h)/2" c:\subs\encoded.mp4

but the problem is that it doens't stop at the end of original file...
but is working and i want to thank you!!!!
emcodem
Posts: 1749
Joined: Wed Sep 19, 2018 8:11 am

Re: BURN IN SUBS

Post by emcodem »

Hey Backlight,

Great that you were able to understand and play with the ffmepg command i submitted.
Time to finish the ffastrans integration. The duration issue should be solved by just adding a duration to the "color" input of ffmpeg, as shown below.
The other problem is to get the input filename escaped properly, unfortunately we need to use a Populate variable processor and a 2-step formatting for it:
path_to_subtitle.png
path_to_subtitle.png (13.56 KiB) Viewed 9684 times
Create a user variable named original_drive. Then set up the Populate Vars processor as shown above:
First Line (note that \subs\ is added here, and the original extension, i hope you are able to play with it and get it right using the "write text file"):

Code: Select all

$jsonencode($jsonencode("%s_original_drive%%s_original_folder%\subs\%s_original_name%.%s_original_ext%.ass"))
Second Line:

Code: Select all

$replace("%s_path_to_subtitle%",":","\\:")
Your commandline node could look like that:

Code: Select all

cmd /C ""%s_ffmpeg%" -f lavfi -i "color=white@0.0:duration=%f_duration%:size=%i_width%x%i_height%:rate=%f_frame_rate%,format=rgba,subtitles='%s_path_to_subtitle%'" 
 filter_complex "overlay=(W-w)/2:(H-h)/2" "e:\temp\%s_original_name%.%s_original_ext%""
Or if you run lucky, you can even use the custom ffmpeg but i don't know if it supports "-i" :

Code: Select all

-f lavfi -i "color=white@0.0:duration=%f_duration%:size=%i_width%x%i_height%:rate=%f_frame_rate%,format=rgba,subtitles='%s_path_to_subtitle%'" 
 filter_complex "overlay=(W-w)/2:(H-h)/2"
Let me know if you have troubles with that
emcodem, wrapping since 2009 you got the rhyme?
Post Reply