[FFmpeg-user] Remove black border on both up/down and left/bottom
Terje J. Hanssen
terjejhanssen at gmail.com
Fri May 23 17:44:37 EEST 2025
Den 22.05.2025 22:10, skrev Terje J. Hanssen:
>
>
> Den 20.05.2025 14:16, skrev Richard Bartczak via ffmpeg-user:
>> Hello,
>>
>> video recorded for 4/3 :
>>
>> Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
>> yuv420p(tv, bt470bg, top first), *720x576 [SAR 16:15 DAR 4:3]*, 25
>> fps, 25 tbr, 90k tbn
>>
>> (container ts).
>>
>> What I want to have is something like that :
>>
>> Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
>> yuv420p(tv, top first), *720x576 [SAR 64:45 DAR 16:9]*, 25 fps, 25
>> tbr, 90k tbn
>>
>> Did some tries with -vf scale=720:576,setsar=64:45,setdar=16:9 or
>> something like that. But the result neither have the expected size
>> nor the video quality will be acceptable.
>>
>> To resize the video via TV-settings will be possible, I hope the
>> transformation will also be possible without reencoding.
>>
>> Any idea what to do ?
>
>
> I'm not quite sure what you really want to do. But it seems to me that
> your recorded input is a PAL SD 4:3 video format that you want to
> transform to a SD Wide anamorphic wide video format to display without
> black borders on a 16:9 wide screen (possibly in a "DVD Wide
> compliant" mpeg2 format?)
>
> If so, it seems to me you'll need to crop top and bottom borders from
> your input format to get a 16:9 aspect frame, that is 720x405 px.
>
> There are several posts and references about cropping to look at.
To add:
Here is how I created DVD Widescreen (16:9) compliant mpg files from PAL
SD 4:3 (DV) 720x576 source files using ffmpeg on Linux.
I've tested it works as well using a equivalent mpg input format.
This was based on WinFF's preset for PAL DVD HQ Widescreen.
To keep the correct geometry on the16:9 video image, it has to be
cropped at top and bottom.
I didn't get only scale without cropping and re-encoding to work as
suggested somewhere.
It would be of interest if someone have a working solution.
H = W x 9/16 = 720 x 9/16 = 405 px of the 16:9 image
Total crop top/bottom: 576 - 405 = 171 px
After some testing I shared this (crop:ih) at top 106 px and bottom 65 px:
-vf crop=iw-0-0:ih-106-65:0:106
because in my case I wonted the recorded time and date at the bottom to
be kept with cut off.
ffmpeg -hide_banner -i DV01.dv -f dvd -target pal-dvd -aspect 16:9 -vb
8000k -mbd rd -trellis 1 -cmp 0 -subcmp 2 -vf
crop=iw-0-0:ih-106-65:0:106 -flags +ilme+ildct DVD-Wide.mpg
Input:
Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 16:15 DAR 4:3], 25000
kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Output:
Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, bottom coded first
(swapped)), 720x576 [SAR 64:45 DAR 16:9], q=2-31, 6000 kb/s, 25 fps, 90k tbn
The 16:9 output file tested as ok with ffplay and VLC
Terje J. Hanssen
>
> But first I'll suggest to take a look at these illustrative figures to
> clarify your actual case:
>
> Widescreen with SD video
> https://www.sandelinmedia.com/widescreen/
>
> We also discussed a similar topic on the Cinelerra-GG mailing list
>
> Missing preset for SD 16:9 Anamorphic Wide DV(D)
> https://www.mail-archive.com/cin@lists.cinelerra-gg.org/msg02081.html
>
> Terje J. Hanssen
>
>
>
>
>
>
>
>
>
>
>
More information about the ffmpeg-user
mailing list