[FFmpeg-user] Upscaling SD 4x3 to FullHD 16x9 - Aspect Ratio problem
Hello I am trying to upscale a 720x608 (incl VBI) 25i 4:3 source to 1920x1080 25i 16:9. My deinterlacing and reinterlacing is working, scaling and cropping too. But I have understanding problem how to use the videofilter regarding aspect ratios. My source is 4:3 and the target is 16:9. For the target I am expecting that I get a PillarBox FullHD image (black bars left and right) where the original 4:3 aspect ratio of the source is kept. PROBLEM: But I get only a stretched 16:9 HD version of the 4:3 original image. (no black bars at left and right) See files: https://www.dropbox.com/s/mgwmiitcpgta0ym/scalertest.zip?dl=0 CommandLineOutput: ffmpeg -i "F:\scaler test\_5sec.avi" -vf "crop=720:576:0:32, setfield=tff, yadif=1:0:0, scale=-1:1080, tinterlace=interleave_top, fieldorder=tff" -vcodec ffvhuff -an -s 1920x1080 -aspect 16:9 "F:\scaler test\_5sec_fullHDinterlaced.avi" ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 7.2.0 (GCC) configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat57. 83.100 / 57. 83.100 libavdevice57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc54. 7.100 / 54. 7.100 Input #0, avi, from 'F:\scaler test\_5sec.avi': Metadata: encoder : Lavf58.12.100 Duration: 00:00:05.00, start: 0.00, bitrate: 116115 kb/s Stream #0:0: Video: ffvhuff (FFVH / 0x48564646), yuv422p, 720x608, 107684 kb/s, SAR 152:135 DAR 4:3, 25 fps, 25 tbr, 25 tbn, 25 tbc Stream #0:1: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, 7.1, s32 (24 bit), 9216 kb/s File 'F:\scaler test\_5sec_fullHDinterlaced.avi' already exists. Overwrite ? [y/N] y Stream mapping: Stream #0:0 -> #0:0 (ffvhuff (native) -> ffvhuff (native)) Press [q] to stop, [?] for help Output #0, avi, to 'F:\scaler test\_5sec_fullHDinterlaced.avi': Metadata: ISFT: Lavf57.83.100 Stream #0:0: Video: ffvhuff (FFVH / 0x48564646), yuv422p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc Metadata: encoder : Lavc57.107.100 ffvhuff frame= 125 fps= 53 q=-0.0 Lsize= 200261kB time=00:00:05.00 bitrate=328108.1kbits/s speed=2.14x video:200253kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.004325% Best Regards Christoph Gerstbauer ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Upscaling SD 4x3 to FullHD 16x9 - Aspect Ratio problem
Le ven. 22 juin 2018 à 14:43, Christoph Gerstbauer < christophgerstba...@gmail.com> a écrit : > PROBLEM: But I get only a stretched 16:9 HD version of the 4:3 original > image. (no black bars at left and right) > > ffmpeg -i "F:\scaler test\_5sec.avi" -vf "crop=720:576:0:32, setfield=tff, > yadif=1:0:0, scale=-1:1080, tinterlace=interleave_top, fieldorder=tff" > -vcodec ffvhuff -an -s 1920x1080 -aspect 16:9 "F:\scaler > test\_5sec_fullHDinterlaced.avi" > The "-s" option is incorrect in your case. From the documentation: > As an output option, this inserts the scale video filter to the end of the corresponding filtergraph. Please use the scale filter directly to insert it at the beginning or some other place. The scale video filter will take whatever ends up from your filter, and scale it without respect to aspect ratio. To do what you want, you probable have to use a complex filter, where you create a secondary black source and paste the output of your current filter into it using the "overlay" filter. ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Upscaling SD 4x3 to FullHD 16x9 - Aspect Ratio problem
On 22-06-2018 06:13 PM, Christoph Gerstbauer wrote: CommandLineOutput: ffmpeg -i "F:\scaler test\_5sec.avi" -vf "crop=720:576:0:32, setfield=tff, yadif=1:0:0, scale=-1:1080, tinterlace=interleave_top, fieldorder=tff" -vcodec ffvhuff -an -s 1920x1080 -aspect 16:9 "F:\scaler Since you're scaling proportionally ("-1:1080"), you need to pad out the frame to FHD. ffmpeg -i in -vf "crop=720:576:0:32,setfield=tff,yadif=1:0:0, scale=-1:1080,pad=1920:1080:(ow-iw)/2:(oh-ih)/2, tinterlace=interleave_top, fieldorder=tff, setsar=1" -c:v ffvhuff -an -aspect 16:9 out Additionally, since your input isn't square-pixels, the following scale may be more accurate, scale=oh*4/3:1080 Regards, Gyan ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Upscaling SD 4x3 to FullHD 16x9 - Aspect Ratio problem
> > > The "-s" option is incorrect in your case. From the documentation: > > As an output option, this inserts the scale video filter to the end of > the corresponding filtergraph. Please use the scale filter directly to > insert it at the beginning or some other place. > > The scale video filter will take whatever ends up from your filter, and > scale it without respect to aspect ratio. > To do what you want, you probable have to use a complex filter, where you > create a secondary black source and paste the output of your current filter > into it using the "overlay" filter. > I understand So i need to generate (after the cropping and deinterlacing to 720x576 50p) a filter syntax (within the videofilter) which transforms the 720x576 4:3 content to a pillarbox 1050x576 quare pixel video (with black bars at sides) -> and THIS one I can rescale to HD. Correct? if yes, has anyone more experience with that? br Chris ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Upscaling SD 4x3 to FullHD 16x9 - Aspect Ratio problem
Le ven. 22 juin 2018 à 15:10, Christoph Gerstbauer < christophgerstba...@gmail.com> a écrit : > > > > > > The "-s" option is incorrect in your case. From the documentation: > > > As an output option, this inserts the scale video filter to the end of > > the corresponding filtergraph. Please use the scale filter directly to > > insert it at the beginning or some other place. > > > > The scale video filter will take whatever ends up from your filter, and > > scale it without respect to aspect ratio. > > To do what you want, you probable have to use a complex filter, where you > > create a secondary black source and paste the output of your current > filter > > into it using the "overlay" filter. > > > > I understand > So i need to generate (after the cropping and deinterlacing to 720x576 50p) > a filter syntax (within the videofilter) which transforms the 720x576 4:3 > content to a pillarbox 1050x576 quare pixel video (with black bars at > sides) -> and THIS one I can rescale to HD. > Correct? > > if yes, has anyone more experience with that? > Roughly. Look at the other answer; it basically does the pillarbox *after* the initlal rescale, which is probably a better idea. ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Upscaling SD 4x3 to FullHD 16x9 - Aspect Ratio problem
Here is an interesting article: https://avpres.net/FFmpeg/SD_HD.html as far as scaling and re-sampling algo goes I would invoke avisynth and try thin raster with Spline64Resize(1440,1080) as it usually gives better Y-PSNR metric. Try also sinc re-sampler and see if it suits your case. Once material is with a lot of fractal details I get crisper results with it. I would also consider colorspace matrix compensation for luma coefficients like colormatrix=bt601:bt709 and then your padding formula pad=1920:1080:240:0 Re-interlacing might not be necessary after all, even if it goes to play-out. Kind Regards. . On Fri, Jun 22, 2018 at 3:19 PM, Cley Faye wrote: > Le ven. 22 juin 2018 à 15:10, Christoph Gerstbauer < > christophgerstba...@gmail.com> a écrit : > > > > > > > > > > The "-s" option is incorrect in your case. From the documentation: > > > > As an output option, this inserts the scale video filter to the end > of > > > the corresponding filtergraph. Please use the scale filter directly to > > > insert it at the beginning or some other place. > > > > > > The scale video filter will take whatever ends up from your filter, and > > > scale it without respect to aspect ratio. > > > To do what you want, you probable have to use a complex filter, where > you > > > create a secondary black source and paste the output of your current > > filter > > > into it using the "overlay" filter. > > > > > > > I understand > > So i need to generate (after the cropping and deinterlacing to 720x576 > 50p) > > a filter syntax (within the videofilter) which transforms the 720x576 4:3 > > content to a pillarbox 1050x576 quare pixel video (with black bars at > > sides) -> and THIS one I can rescale to HD. > > Correct? > > > > if yes, has anyone more experience with that? > > > > Roughly. Look at the other answer; it basically does the pillarbox *after* > the initlal rescale, which is probably a better idea. > ___ > ffmpeg-user mailing list > ffmpeg-user@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-user > > To unsubscribe, visit link above, or email > ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Upscaling SD 4x3 to FullHD 16x9 - Aspect Ratio problem
Gyan Doshi thank you, that worked fine! 2018-06-22 15:09 GMT+02:00 Gyan Doshi : > > > On 22-06-2018 06:13 PM, Christoph Gerstbauer wrote: > > >> CommandLineOutput: >> >> ffmpeg -i "F:\scaler test\_5sec.avi" -vf "crop=720:576:0:32, setfield=tff, >> yadif=1:0:0, scale=-1:1080, tinterlace=interleave_top, fieldorder=tff" >> -vcodec ffvhuff -an -s 1920x1080 -aspect 16:9 "F:\scaler >> > > Since you're scaling proportionally ("-1:1080"), you need to pad out the > frame to FHD. > > ffmpeg -i in -vf "crop=720:576:0:32,setfield=tff,yadif=1:0:0, > scale=-1:1080,pad=1920:1080:(ow-iw)/2:(oh-ih)/2, > tinterlace=interleave_top, fieldorder=tff, > setsar=1" >-c:v ffvhuff -an -aspect 16:9 out > > Additionally, since your input isn't square-pixels, the following scale > may be more accurate, > > scale=oh*4/3:1080 > > Regards, > Gyan > > ___ > ffmpeg-user mailing list > ffmpeg-user@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-user > > To unsubscribe, visit link above, or email > ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".