I have a video with existing hard subs at the bottom in Chinese. I'm trying to add a black bar to the bottom of the video and render more hard subs in that space in English, so they don't obscure the Chinese subs, then render to H264 all in a single step to avoid quality loss. I've done this in VirtualDub with ffmpeg as an External Encoder, using the TextSub and resize filters, set to Letterbox and adding around 160 pixels. Unfortunately it splits the letterbox to the top and bottom - any ideas how to fix this so it is on the bottom only? Is there another filter, or some better software perhaps? I was unable to achieve something similar in Handbrake, although I think that should also be possible.
Thanks for any help in this weird situation!
+ Reply to Thread
Results 1 to 9 of 9
AviSynth can do it with its AddBorders command. Then the Textsub filter can be used on an SSA file of the subs with the positioning already determined. That script can be opened in VDub to do the rest of what you want.
Since letterboxing, almost by definition, means black added both above and below, I doubt you'll get anywhere using it in VDub.
Thank you both for your speedy responses.
I found the Border Control VirtualDub plugin here. Unfortunately it is not able to actually increase the frame size, the border filters it offer extend only inwards from the frame. This would have been ideal if I wanted to black out or blur the existing subtitles, but we are aiming for bilingual screening so this is not ideal. We also didn't want to put English subtitles on top, because the documentary features a lot of graphs which would have their titles obscured in this case.
I then turned to AviSynth (my first time using this incredible tool). My first obstacle was getting it to read the H264-AVC source file. This was achieved by installing the FFMS2 plugin for AviSynth from here. I copid the DLL, LIB and EXE files from the x86 architecture folder into the AviSynth plugin folder, as well as the .avsi file - not sure if this strictly correct, but it worked. AviSynth was configured as follows in a text file I creatively named blackbottom.avs:
AddBorders(0, 0, 0, 120, $000000)
This file could then be opened as a video source in VirtualDub. I applied the TextSub filter and loaded my ASS subtitles, making all font settings in the ASS file itself. I installed a pre-compiled ffmpeg binary from here, and found a .vdprof preset for import into VirtualDub here. I created a new encoder set based on this, using x264 to encode video, ac3 to encode audio and mp4 as a muxer and container. (I believe this will force the audio to be re-encoded instead of passed through, but at this point I was getting pretty exhausted.) One problem I consistently had was that AviSynth did not seem to be providing any audio stream, so the external encoder would fail during multiplexing with error code 00000001. This was because there was no audio stream to multiplex. Instead of fixing my problem in AviSynth, I worked around it by telling VirtualDub to load an alternative audio stream, and then pointing at the same source MP4 file. I really love point and click menus.
Screenshot of the result, note that the black bar exists in the left frame already because it is added by the AviSynth AddBorders command and not by a VirtualDub filter:
Thank you both for pointing me in the right direction, I'm sure there is a more correct way of doing this purely in AviSynth, but I didn't have time to learn about how compress AviSynth output correctly. I hope someone else finds this useful!
transparent area for subs
-vf "scale=1280:-1:sws_flags=spline+accurate_rnd+full_chroma_int+full_chroma_inp:sws_dither=a_dither [v1] ; color=c=0x000000AA:s=1280x128 [v2] ; [v1] [v2] overlay=0:H-128"
Last edited by pandy; 12th Mar 2015 at 09:47.
Thanks jagabo, just tested your solution and it is really much more elegant. Will use it next time!