VideoHelp Forum
+ Reply to Thread
Results 1 to 28 of 28
Thread
  1. Hi but please: have lot of patience because I'm a ***

    why all over the world I cannot find an avsi script to convert 4:3 to 16:9 in crop/resize mode?

    please consider my sources of the same framing shot:

    https://www.dropbox.com/s/swfal9i0zrshu2r/PAL_HD.MXF?dl=0 (PAL HD 1920x1080, interlaced)
    https://www.dropbox.com/s/c15ua94fq87lxyu/PAL_720_576_169.MXF?dl=0 (PAL IMX/SD 720X576 16:9 aspect ratio, interlaced)
    https://www.dropbox.com/s/jvmsl3bgvvssnzo/PAL_720_576_43.MXF?dl=0 (PAL IMX/SD 720X576 4:3 aspect ratio, interlaced)


    https://www.dropbox.com/s/wqfm5cixmzftvi0/NTSC_HD.MXF?dl=0 (NTSC HD 1920x1080, interlaced)
    https://www.dropbox.com/s/n58kj14zna2xhf7/NTSC_720_486_169.MXF?dl=0 (NTSC IMX/SD 720X486 16:9, interlaced)
    https://www.dropbox.com/s/s3p5gz8lal9ipi1/NTSC_720_486_43.MXF?dl=0 (NTSC IMX/SD 720X486 4:3 aspect ratio, interlaced)

    I wonder what is the best way to convert the 4:3 ones in 16:9, even if loss of quality and in crop/resize mode. And avisynth 64bit?. I need to build an automatic batch that recognize the 4:3 sources, and if necessary crop/resize to match in 16:9. Thanks
    Quote Quote  
  2. Originally Posted by marcorocchini View Post
    why all over the world I cannot find an avsi script to convert 4:3 to 16:9 in crop/resize mode?
    Because the operation is so trivial nobody would bother posting a script. manono already told you what to do: remove 25 percent of the height of the frame then resize what's left to the 16:9 frame size you want.

    Your "I'm just a dumb cat" shtick has grown far beyond tedious. Try using your brain for once. You'll find life much easier.
    Last edited by jagabo; 21st Oct 2017 at 07:55.
    Quote Quote  
  3. I know jagabo *** but it needs a calculation of the 25% every time

    Image
    [Attachment 43460 - Click to enlarge]


    possibly I would like do a batch that do it all in automatic, for every 4:3 sources, at every resolutions
    Quote Quote  
  4. Just make a function that calculates 25 percent for you, crops, then resizes. This is one of the simplest problems. Learn to think for yourself and you won't have to rely on others for every little thing.
    Quote Quote  
  5. I agree with jagabo: the "cat" thing is childish and dumb. Why keep doing it? Also, the crop/resize is two lines of code and you have already been given the answer. What is the point of this post??
    Quote Quote  
  6. Originally Posted by johnmeyer View Post
    the crop/resize is two lines of code
    what is this 2 lines?
    Quote Quote  
  7. Here's a hint for you: 25 percent equals 1/4. So 12.5 percent = 1/8.
    Quote Quote  
  8. Beside what Jagabo told you:

    1 + 1 = 2
    Quote Quote  
  9. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    This kind of bullshit (1-I need help to do everything, 2-won't make effort but will go to great lengths to avoid same, 3-cat crap stopped being palatable after oh the 100th time) was the reason I stopped coming to his assistance, with one or 2 exceptions.

    Scott
    Quote Quote  
  10. I try the hello_Hellocat script that seems ok to do this

    https://forum.videohelp.com/attachments/43454-1508563458/CropResizeBorder_ColouredBorders3.avsi

    Code:
    Import("v:\automazioneclip\avisynth\plugins\IResize.avsi")
    Import("v:\automazioneclip\avisynth\plugins\CropResizeBorder_ColouredBorders3.avsi")
    LoadPlugin("v:\automazioneclip\AviSynth\Lsmash64perVirtualDub64\LSMASHSource.dll")
    LoadCPlugin("v:\automazioneclip\avisynth\plugins64\yadif.dll")  
    LWLibavVideoSource("C:\Users\Administrator\Desktop\PAL\PAL_720_576_43.MXF").crop(0,32,0,0)     
    
    ConvertToYUY2(interlaced=true)
      
    yadif(1,1)
     
    CropResizeBorder(Cmode="NR", InDAR=4.0/3.0, PicDAR=16.0/9.0)
    LancZosResize(720,576)
    AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()
    
    AssumeFPS(25)
    hello_hello image seems ok but a little "zoomed" respect to the 16:9 one ... I know: because of the crop. But I wonder if is there a way to gain a little higher portion of the image up and down, even with a slight distorsion if necessary
    Quote Quote  
  11. I have do a mess
    Quote Quote  
  12. Please I need to made a batch that returns the aspect ratio "quotient"

    for example 4:3= quotient 1,33333333333333333

    I need to do a batch that returns simply 1,33. How can I do? please help a poor cat

    ************************************************** ******************
    %V_Width%=720
    %V_Height%=576


    Code:
    Set /a quotient=%V_Width%/%V_Height%
    but it don't work: for example 1280/720 -->1
    Last edited by marcorocchini; 21st Oct 2017 at 16:43.
    Quote Quote  
  13. Set /a only works in integer. You have to simulate floating point with fixed point.

    https://stackoverflow.com/questions/25951196/set-command-floating-point-numbers
    Quote Quote  
  14. Originally Posted by marcorocchini View Post
    I try the hello_Hellocat script that seems ok to do this

    https://forum.videohelp.com/attachments/43454-1508563458/CropResizeBorder_ColouredBorders3.avsi

    Code:
    Import("v:\automazioneclip\avisynth\plugins\IResize.avsi")
    Import("v:\automazioneclip\avisynth\plugins\CropResizeBorder_ColouredBorders3.avsi")
    LoadPlugin("v:\automazioneclip\AviSynth\Lsmash64perVirtualDub64\LSMASHSource.dll")
    LoadCPlugin("v:\automazioneclip\avisynth\plugins64\yadif.dll")  
    LWLibavVideoSource("C:\Users\Administrator\Desktop\PAL\PAL_720_576_43.MXF").crop(0,32,0,0)     
    
    ConvertToYUY2(interlaced=true)
      
    yadif(1,1)
     
    CropResizeBorder(Cmode="NR", InDAR=4.0/3.0, PicDAR=16.0/9.0)
    LancZosResize(720,576)
    AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()
    
    AssumeFPS(25)
    hello_hello image seems ok but a little "zoomed" respect to the 16:9 one ... I know: because of the crop. But I wonder if is there a way to gain a little higher portion of the image up and down, even with a slight distortion if necessary
    Sure there is. Crop it to less than 16:9, then resize it to 16:9 to stretch it. Why you'd want to do that, I don't know... I'd prefer small black borders to stretching, but I'd still tend to crop a little more from the bottom than from the top, because the centre of action tends to be a little above the centre of the frame for 4:3.

    There's always the SimpleResize plugin, which I mentioned in your previous thread, but I've no idea if there's a 64 bit version. Here's an example of resizing a 4:3 DVD to 16:9 after cropping it to 1.6:1 so it doesn't get stretched too much.

    The original image is first, resized to square pixels (656x480).

    For the second image I disabled auto-cropping so I could crop manually, and set a picture display aspect ratio of 1.6.
    CropResizeBorder is temporarily followed by Info() so I could see the height after cropping, then that's followed by WarpResized2, which stretches to 16:9.

    Yadif(mode=1)
    CropResizeBorder(0, 0, 12, 0, 8, 24, InDAR=15.0/11.0, PicDAR=1.6, Cthresh=0, Cmode="NR")
    Info()
    WarpedResize2(704,396, 0.9, 1)

    You don't lose a much picture as you would if you cropped to 16:9, and WarpResized2 stretches the image more at the edges than in the middle, so the stretching isn't as painful (you can see the circles are stretched at the edges).

    Personally I think it's still fairly horrible (I'm not adverse to copping, but I don't like stretching), but it's another way of doing it. As I said though, I've no idea if there's a 64 bit version of SimpleResize. I haven't looked.

    http://avisynth.nl/index.php/SimpleResize
    Image Attached Thumbnails Click image for larger version

Name:	1.jpg
Views:	164
Size:	51.7 KB
ID:	43465  

    Click image for larger version

Name:	2.jpg
Views:	204
Size:	66.5 KB
ID:	43466  

    Last edited by hello_hello; 21st Oct 2017 at 20:46.
    Quote Quote  
  15. it does not happen often, almost never: but when you mix videos 16:9 with (old) 4:3 for news it's aesthetically very ugly to see the black or fuzzycat side bars.
    Clearly the dominant format is always 16:9, if for example some archive 4:3 images should take in a journalistic service of 1 minute it's not a good idea to see the fuzzy borders for few seconds sometimes: I know quality is horrible but the journalistic'eye prefers the drop in quality to the side bars in these cases.

    Hello_hello so to have the image less "zoomed" the only way is to manually set the avisynth line? my paw has difficulty touching the pc's numeric keypad

    is there a way to set the amount of cropped lines as % ?
    Jagabo spoke of the percentage of lines to be lifted up and down: to automatically do this in a batch I suppose it is necessary to extract the width and height data (from mediainfo or ffprove) and make a math calculation. How do pratically do this calculation inside a batch?
    Quote Quote  
  16. However considering

    Code:
    CropResizeBorder(Cmode="NR", InDAR=4.0/3.0, PicDAR=16.0/9.0)
    I try to build a way that in a batch pickup in anyway the dividend and divisor of the DAR aspect ratio to put it on the line served for avisynth.

    For example:

    mediainfo return that my source is

    Code:
    Video
    ID                                       : 2
    Format                                   : MPEG Video
    Commercial name                          : IMX 50
    Format version                           : Version 2
    Format profile                           : 4:2:2@Main
    Format settings, BVOP                    : No
    Format settings, Matrix                  : Default
    Format settings, GOP                     : N=1
    Format settings, picture structure       : Frame
    Format settings, wrapping mode           : Frame (D-10)
    Codec ID                                 : 0D01030102010101-0401020201020101
    Duration                                 : 23 s 120 ms
    Bit rate mode                            : Constant
    Bit rate                                 : 50.0 Mb/s
    Width                                    : 720 pixels
    Height                                   : 576 pixels
    Original height                          : 608 pixels
    Display aspect ratio                     : 4:3
    Frame rate                               : 25.000 FPS
    Standard                                 : PAL
    Color space                              : YUV
    Chroma subsampling                       : 4:2:2
    Bit depth                                : 8 bits
    Scan type                                : Interlaced
    Scan order                               : Top Field First
    Compression mode                         : Lossy
    Bits/(Pixel*Frame)                       : 4.823
    Stream size                              : 139 MiB (80%)
    Transfer characteristics                 : BT.470
    I would like extract the dividend: 4
    and divisor: 3

    and put 4 and 3 in the "InDAR" parameter of the CropResizeBorder function.

    How cat can I do? And possibly do dividend/divisor to get final result and get the quotient_aspect_ ratio

    if quotient_aspect_ ratio > 1,2 -and different from 16:9 ---> use CropResize to get aspectRatioAdaption
    if quotient_aspect_ ratio < 1,2 ---> use The Fuzzycat effect to get aspectRatioAdaption with side bars
    Quote Quote  
  17. https://mediaarea.net/en/MediaInfo/Download/Windows
    Download the CLI version of MediaInfo, not the GUI

    https://fossies.org/linux/MediaInfo_CLI/MediaInfo/Contrib/CLI_Help.doc
    CLI_Help.doc

    Armed with the above (plus some Googling, Stack Exchange to the rescue again), I was able to write this...

    MediaInfo-aspect.bat
    Code:
    @echo off
    ::****SET PATH TO MEDIAINFO CLI****
    E:
    cd "\Programs\MediaInfoCLI\x86\"
    
    MediaInfo.exe "--Inform=Video;%%Width%%"            "%~dpnx1" > "%~dpnx1-MediaInfo-Width.txt"
    MediaInfo.exe "--Inform=Video;%%Height%%"           "%~dpnx1" > "%~dpnx1-MediaInfo-Height.txt"
    MediaInfo.exe "--Inform=Video;%%AspectRatio%%"      "%~dpnx1" > "%~dpnx1-MediaInfo-Aspect.txt"
    MediaInfo.exe "--Inform=Video;%%PixelAspectRatio%%" "%~dpnx1" > "%~dpnx1-MediaInfo-PixAsp.txt"
    
    :WAIT_2
    if not exist "%~dpnx1-MediaInfo-Width.txt"  ping 127.0.0.1 -n 2
    if not exist "%~dpnx1-MediaInfo-Width.txt"  goto WAIT_2
    if not exist "%~dpnx1-MediaInfo-Height.txt" ping 127.0.0.1 -n 2
    if not exist "%~dpnx1-MediaInfo-Height.txt" goto WAIT_2
    if not exist "%~dpnx1-MediaInfo-Aspect.txt" ping 127.0.0.1 -n 2
    if not exist "%~dpnx1-MediaInfo-Aspect.txt" goto WAIT_2
    if not exist "%~dpnx1-MediaInfo-PixAsp.txt" ping 127.0.0.1 -n 2
    if not exist "%~dpnx1-MediaInfo-PixAsp.txt" goto WAIT_2
    
    set /p MINFO_WID=<"%~dpnx1-MediaInfo-Width.txt"
    set /p MINFO_HGT=<"%~dpnx1-MediaInfo-Height.txt"
    set /p MINFO_ASP=<"%~dpnx1-MediaInfo-Aspect.txt"
    set /p MINFO_PIX=<"%~dpnx1-MediaInfo-PixAsp.txt"
    
    @echo.
    @echo Width x Height is %MINFO_WID% x %MINFO_HGT%
    @echo Aspect is %MINFO_ASP%; PixAspect is %MINFO_PIX%
    @echo.
    pause
    del /q "%~dpnx1-MediaInfo-Width.txt"
    del /q "%~dpnx1-MediaInfo-Height.txt"
    del /q "%~dpnx1-MediaInfo-Aspect.txt"
    del /q "%~dpnx1-MediaInfo-PixAsp.txt"
    
    goto :EOF
    Console output:
    Code:
    E:\Programs\MediaInfoCLI\x86>MediaInfo-aspect "D:\VideoProjects\work\test.m4v"
    
    Width x Height is 710 x 478
    Aspect is 1.320; PixAspect is 0.889
    
    Press any key to continue . . .
    Last edited by raffriff42; 22nd Oct 2017 at 20:06. Reason: link
    Quote Quote  
  18. we went thru this a while ago ... cats forget though ... something like this, based on this


    Code:
    "C:\tools\Mediainfo CLI\Mediainfo.exe" "%~1" > mediaifo.txt
    for /f "tokens=1,2,3 delims=:" %%a in ('findstr /c:"Display aspect ratio   " "mediaifo.txt"') do set InDAR=%%b/%%c
    Quote Quote  
  19. Very nice. Somehow I missed those posts of yours.
    Quote Quote  
  20. Originally Posted by _Al_ View Post
    we went thru this a while ago ...
    Yes, he doesn't learn from previous experience. Probably because people here spoon feed him answers to every question. That's why I was trying to force him to think about his crop/scale problem. It was a simple issue and solving it himself would have taught him something.
    Quote Quote  
  21. Member DB83's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    The OP is either very clever or very stupid or something in between.

    Clever if his posts are a subtle form of trolling/spamming. Stupid if he can not or will not think for himself.

    But he does appear to take the 'help' quality of the forum somewhat too far.

    I learnt a long time ago that the best form of help is self-help. Get it wrong and try something else. And only ask for assistance when all else fails.
    Quote Quote  
  22. I know I'm being trolled. I only respond when the solution is interesting to me. Notice I did not write a full working batch file to order. I addressed the issue I happened to be interested in -- extracting particular properties from a MediaInfo report. Wish I had recalled _AI_'s solution, but oh well.
    Quote Quote  
  23. I think the same, we all can answer or not. Here or there one gets some ideas. Like for example, his original script was designed by ndjamena (not sure if nick is correct) and there was lots of approaches in that script that make batch scripts simple, like merging functions within each other.
    Quote Quote  
  24. thank you _al_cat but maybe I'm not shure it works for all the cases, because now I have noted that sometimes mediainfo don't take the Display aspect ratio value with the usual notation "dividend/divisor" (eg. 16:9 or 4:3 etc..) but in my cases and in my proof - for example 0,563 of this case

    Code:
    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L3.2
    Format settings                          : CABAC / 4 Ref Frames
    Format settings, CABAC                   : Yes
    Format settings, RefFrames               : 4 frames
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 2 min 4 s
    Bit rate                                 : 953 kb/s
    Width                                    : 720 pixels
    Height                                   : 1 280 pixels
    Display aspect ratio                     : 0.563
    Frame rate mode                          : Constant
    Frame rate                               : 29.970 (30000/1001) FPS
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.035
    Stream size                              : 14.1 MiB (87%)
    Writing library                          : x264 core 148 r2665 a01e339
    so that %%c results as not defined.
    However it's interesting to pickup others mediainfo values
    Quote Quote  
  25. seems that the quotient is correctly get using the rafficat solution:

    cause the use of specific line:

    Code:
    MediaInfo.exe "--Inform=Video;%%AspectRatio%%"      "%~dpnx1" > "%~dpnx1-MediaInfo-Aspect.txt"
    that retuns alwais the quotient value and not the the standard "display aspect ratio" achieved using my usual and generic

    Code:
            mediainfo.exe "%~dpnx1" dumpinfo:unicodefile.txt
    that get in some case 16:9 or 4:3 or 3:2 but also 0,563 or similar

    In fact the rafficat script alwais don't get the "display aspect ratio" value, which would be misleading for the InDar entry
    Last edited by marcorocchini; 25th Oct 2017 at 05:05.
    Quote Quote  
  26. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    They mean the same thing.
    When it shows something like 0.563, that means 0.563:1. Just as 4:3 means 1.33333:1 and 16:9 means 1.7777777:1. Ratios always have 2 numbers, whether they're explicit or implied, whether they try to reduce to whole integers or reduce to a fraction vs 1.

    Scott
    Quote Quote  
  27. I though you use camcorder footage only 4:3 or 16:9,
    but sure, use that: MediaInfo.exe "--Inform=Video;%%AspectRatio%%"
    if it brings the fraction all the time
    Quote Quote  
  28. Originally Posted by marcorocchini View Post
    it does not happen often, almost never: but when you mix videos 16:9 with (old) 4:3 for news it's aesthetically very ugly to see the black or fuzzycat side bars.
    Clearly the dominant format is always 16:9, if for example some archive 4:3 images should take in a journalistic service of 1 minute it's not a good idea to see the fuzzy borders for few seconds sometimes: I know quality is horrible but the journalistic'eye prefers the drop in quality to the side bars in these cases.
    I've have old BBC TV shows and the "DVD Extras" are often 16:9 even though the episodes themselves are 4:3. When they insert segments of old footage (or footage from an episode) it's sometimes cropped to 16:9, sometimes cropped to around 1.5:1 with black bars, sometimes it's 4:3 with black bars and sometimes it's 4:3 with pretty borders around it. It probably depends what works in context and who's authoring the DVD, but I don't find any one method any more annoying than another (although even though I often crop 4:3 to 16:9 for viewing myself, in that context I prefer the cropping method the least). It's a fact of life 4:3 isn't the same shape as 16:9.

    This is from a Doctor Who DVD. The borders might seem silly at first, but they're actually taken from an episode of the show where the actors were watching something on a monitor that was surrounded by those same borders, so they used them for the DVD extras, and to keep the original effect they made the 4:3 image smaller than it otherwise would be. Whatever works....
    Image Attached Thumbnails Click image for larger version

Name:	DW1.jpg
Views:	171
Size:	27.8 KB
ID:	43504  

    Quote Quote  



Similar Threads

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