VideoHelp Forum




+ Reply to Thread
Results 1 to 11 of 11
  1. Member
    Join Date
    Dec 2005
    Location
    Finland
    Search Comp PM
    Hi,

    I've got some BluRays of a 4:3 TV series. I'd like to encode smaller copies to store on the hard drive so I don't need to get the discs out each time.

    I thought I would crop out the black bars off the sides as I go, which is easy enough for the video stream, but just can't manage to get this to work with the subtitle stream (PGSSUB).

    If I only crop the video (crop=1440:1080:240:0), the subtitles get squeezed horizontally. The subtitle stream can be filtered similarly to the video, but then it stops being a subtitle stream and FFMPEG outputs a file with two video streams (cropped video and cropped subtitle). So basically it can do what I want, but I can't get a useful output file. Can I somehow force the filtered subtitle back into being a subtitle stream? Just a question of order of operations perhaps?

    There also seems to be no PGSSUB encoder, but I'm fine with DVDSUB even if the text then loses some of the anti-aliasing. I don't really want to go through the trouble of OCR'ing all of this.

    So long story short, how would I crop the black bars off both the video and the subtitles?

    Thanks for any input!
    Quote Quote  
  2. Originally Posted by ajk View Post
    Hi,

    I've got some BluRays of a 4:3 TV series. I'd like to encode smaller copies to store on the hard drive so I don't need to get the discs out each time.

    I thought I would crop out the black bars off the sides as I go, which is easy enough for the video stream, but just can't manage to get this to work with the subtitle stream (PGSSUB).

    If I only crop the video (crop=1440:1080:240:0), the subtitles get squeezed horizontally. The subtitle stream can be filtered similarly to the video, but then it stops being a subtitle stream and FFMPEG outputs a file with two video streams (cropped video and cropped subtitle). So basically it can do what I want, but I can't get a useful output file. Can I somehow force the filtered subtitle back into being a subtitle stream? Just a question of order of operations perhaps?

    There also seems to be no PGSSUB encoder, but I'm fine with DVDSUB even if the text then loses some of the anti-aliasing. I don't really want to go through the trouble of OCR'ing all of this.

    So long story short, how would I crop the black bars off both the video and the subtitles?

    Thanks for any input!
    The easiest way is not to crop the video stream, but to leave it at 1920x1080. Then the subtitles will also fit.
    Otherwise, you will first have to extract the subtitle, then adjust it to the new dimensions using Subtitleedit, for example, and then mux the modified subtitle with the cropped video stream.
    Quote Quote  
  3. Member
    Join Date
    Dec 2005
    Location
    Finland
    Search Comp PM
    Thanks, yeah, any solution that I can't automate with FFMPEG will be too troublesome for this many episodes. Leaving it as is was my first idea for sure

    But are you saying that it's definitely impossible to do within FFMPEG? I have previously scaled DVD subtitles to fit a BD image in a similar context, and that worked fine (I think using 'canvas_size'). Somehow these BD subs are just behaving differently.
    Quote Quote  
  4. This suggestion won't remove the black sidebars.
    It will give you smaller copies.
    Use BDRebuilder to convert the blu ray disc to DVD9 or even DVD5.
    This will give you about a 9GB or 4.3 GB file.
    It will leave the subtitles as they are.
    You can copy & use just the .mts file of the main movie.
    If you are using a PC media player the .MTS should play with no problem.

    If it is a commercial encrypted blu ray you will need a decrypter.
    XReveal is free.

    There is an old guide here for doing this:
    https://forum.videohelp.com/threads/299579-How-to-shrink-a-Blu-ray-to-DVD-5-DVD-9-or-BD-25
    Quote Quote  
  5. Member
    Join Date
    Dec 2005
    Location
    Finland
    Search Comp PM
    Thanks - I've already got all the BDs ripped to my hard drive, no issue there. I also have a FFMPEG/Python script set up which will automatically re-encode all the episodes to my liking.

    I can certainly let the process run as is, and get usable 1920x1080 files, but this would be a really good opportunity to crop away the bars since I'm re-encoding anyway. I just need guidance with FFMPEG specifically, as it can get pretty complicated with all the filter graphs and stuff.

    This is more or less where I am now:

    ffmpeg -canvas_size 1920x1080 -i input.m2ts -vcodec hevc_nvenc -acodec aac -scodec dvdsub -filter_complex "[0:0]crop=1440:1080:240:0[vid];[0:2]crop=1440:1080:240:0[sub]" -map [vid] -map 0:1 -map [sub] output.mkv

    The problem is the third stream (-map [sub]) doesn't come out as a subtitle stream, but a second video stream. It is, however, cropped properly to match the actual video which is exactly what I would want. It seems like I'm 95% there but some crucial bit is missing!
    Quote Quote  
  6. I hope some member that is better than I am at ffmpeg steps in to help.
    I can tell you your -map settings are not correct.
    The video one should be something like this:-map 0:0
    The audio as you have it.
    The sub may be:
    Code:
    -map 1:0 or -map 0:s:1 or -map 0:s:0
    I'm not sure that -scodec dvdsub will get the subs from the .mts file.
    It might be something like:
    Code:
    -c:s mov_text
    or
    Code:
    -c:s dvd_subtitle
    I had to use code to eliminate the smiles
    Last edited by cholla; 14th Feb 2026 at 14:13. Reason: used code to eliminate smiles
    Quote Quote  
  7. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    There is some interesting discussion herre, not sure if you saw this:
    https://emby.media/community/index.php?/topic/60844-scale-subtitle-stream-to-target-di...nal-dimension/
    Quote Quote  
  8. Member
    Join Date
    Dec 2005
    Location
    Finland
    Search Comp PM
    @cholla

    But if I use "-map 0:0" for the video, won't it just bypass the crop filter and use the original input stream?

    Looking at the documentation, "dvdsub" seems like the appropriate nomenclature when choosing the encoder. Where did you find "dvd_subtitle" from?

    @davexnet

    I had not seen this, it does have some interesting syntax to play around with! However, it seems that in all those examples the output is overlayed on top of the image. I don't really want to burn in the subtitles here, just crop them and maintain a separate stream.
    Quote Quote  
  9. Member
    Join Date
    Dec 2005
    Location
    Finland
    Search Comp PM
    Alright, well I couldn't get FFMPEG to do this by itself. However, I found SupMover which runs on the command line and is able to crop PGSSUBs. So, I first run a script which does:

    Code:
    ffmpeg -i input.m2ts -map 0:2 -c:s copy input.sup
    supmover input.sup output.sup --crop 240 0 240 0
    This leaves me with cropped subtitles, which can then be used as a second input file in the actual FFMPEG command which re-encodes the video. Something like (simplified here):

    Code:
    ffmpeg -i input.m2ts -i output.sup [...video filtering steps here...] -map [video] -map 0:1 -map 1:0 output.mkv
    I did also need to include "-itsoffset" to get the subtitles to start at the correct point in time.

    Not quite a one-liner in the end, but gets the job done in an automated fashion, which was the goal!
    Quote Quote  
  10. Originally Posted by ajk View Post
    @cholla But if I use "-map 0:0" for the video, won't it just bypass the crop filter and use the original input stream?
    It might.
    I run the file I'm working on with ffmpeg with ffmpeg i input.file to see what to use in map.

    Originally Posted by ajk View Post
    Where did you find "dvd_subtitle" from?
    I found dvd_subtitle in my notes for ffmpeg .

    You should find "DES... dvd_subtitle DVD subtitles (decoders: dvdsub) (encoders: dvdsub)" in the ffmpeg codec list using ffmpeg -codecs.

    In this topic at videohelp & probably in more.
    https://forum.videohelp.com/threads/402429-Using-ffmpeg-and-image-based-subtitle-tracks

    In the AI Google here: AI
    Quote Quote  
  11. Member
    Join Date
    Dec 2005
    Location
    Finland
    Search Comp PM
    Ah, yeah I see it in the list. I guess the identifier for this type of stream is "dvd_subtitle" but the encoder for it is referred to as "dvdsub" in FFMPEG.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!