VideoHelp Forum
+ Reply to Thread
Results 1 to 9 of 9
Thread
  1. Member
    Join Date
    Mar 2015
    Location
    Beijing
    Search PM
    Hi guys,

    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.

    Screenshots:

    Click image for larger version

Name:	2015-03-12 00_32_46-Filter_ Resize.png
Views:	563
Size:	41.6 KB
ID:	30677
    Click image for larger version

Name:	2015-03-12 00_36_09-VirtualDub 1.10.4 - [柴静雾霾调查:穹顶之下.2015.HD720P.X264.AAC..png
Views:	325
Size:	911.7 KB
ID:	30678

    Thanks for any help in this weird situation!
    Quote Quote  
  2. 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.

    AddBorders(0,0,0,160)
    TextSub("MovieSubtitles.ssa")

    http://avisynth.nl/index.php/AddBorders

    Since letterboxing, almost by definition, means black added both above and below, I doubt you'll get anywhere using it in VDub.
    Quote Quote  
  3. Other options:

    I think in vdub the filter for AddBorders is called "border control" , a filter plugin

    Avidemux has Add Borders as well
    Quote Quote  
  4. Member
    Join Date
    Mar 2015
    Location
    Beijing
    Search PM
    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:

    FFmpegSource2("C:\chai.mp4")
    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:

    Click image for larger version

Name:	2015-03-12 15_04_02-VirtualDub 1.10.4 - [blackbottom.avs] (dub in progress).png
Views:	236
Size:	467.1 KB
ID:	30685

    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!
    Quote Quote  
  5. ffmpeg
    Code:
    pad=1280:720:(ow-iw)/2:0
    or

    transparent area for subs

    Code:
    -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 10:47.
    Quote Quote  
  6. First use the Resize filter in VirtualDub to add borders (top and bottom), then use the Crop function to remove the border at the top. Then add subs.
    Quote Quote  
  7. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    Originally Posted by jagabo View Post
    First use the Resize filter in VirtualDub to add borders (top and bottom), then use the Crop function to remove the border at the top. Then add subs.
    That works nicely keeping in mind that crop applies to filter input, so it goes on the subtitle filter.
    Quote Quote  
  8. Originally Posted by JVRaines View Post
    Originally Posted by jagabo View Post
    First use the Resize filter in VirtualDub to add borders (top and bottom), then use the Crop function to remove the border at the top. Then add subs.
    That works nicely keeping in mind that crop applies to filter input, so it goes on the subtitle filter.
    I usually add the Null Transform filter for cropping. And one thing to note about cropping: the crop takes place before the filter is applied.
    Quote Quote  
  9. Member
    Join Date
    Mar 2015
    Location
    Beijing
    Search PM
    Thanks jagabo, just tested your solution and it is really much more elegant. Will use it next time!
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!