VideoHelp Forum




+ Reply to Thread
Results 1 to 17 of 17
  1. Hi, the cats
    but

    Code:
    FFImageSource("C:\Users\Administrator\Desktop\Nuova cartella (7)\1_E.E.-Hiolle_Narciso.jpg")
    
    ConvertToYUY2(interlaced=false) 
    
    colorMatrix(mode="Rec.601->Rec.709")
    
    ColorYUV(levels="PC->TV")
    Image
    [Attachment 86327 - Click to enlarge]


    what can it be?
    Quote Quote  
  2. 4:2:2 YUV video must be mod2 in width. So crop a pixel from the width, or add one.
    Quote Quote  
  3. I'm a poor cat.


    In what way I have to crop a pixel from the width, or add one ?
    Quote Quote  
  4. Use Crop() or AddBorders().
    Quote Quote  
  5. Kawaiiii
    Join Date
    May 2021
    Location
    Italy
    Search Comp PM
    I modified your script so it should crop 1 pixel from the left of an image IF its width is not mod2 (making it mod2)

    Code:
    clip=FFImageSource("C:\Users\Administrator\Desktop\Nuova cartella (7)\1_E.E.-Hiolle_Narciso.jpg")
    
    cropV=int(Fmod(clip.Width,2))
    
    clip=clip.crop(cropV,0,0,0)
    
    clip=clip.ConvertToYUY2(interlaced=false) 
    
    clip=clip.colorMatrix(mode="Rec.601->Rec.709")
    
    clip.ColorYUV(levels="PC->TV")
    Quote Quote  
  6. Code:
    clip=FFImageSource("v:\SMPTE bars .jpg")
    
    cropV=int(Fmod(clip.Width,2))
    
    clip=clip.crop(cropV,0,0,0)
    
    
    return (clip)
    
    
    #converttoYV24() #convert to planar
    converttoYV16() #convert to planar
    z_convertformat(interlaced=false,colorspace_op="170m:709:709:l=>709:709:709:l")
    ColorYUV(levels="PC->TV")
    ah wow Image
    [Attachment 86338 - Click to enlarge]


    but can tell to the z_convertformat

    in the "z_convertformat(interlaced=false,colorspace_op="1 70m:709:709:l=>709:709:709:l"" line

    to do what do the "ColorYUV(levels="PC->TV")" ? thanks
    Last edited by marcorocchini; 28th Mar 2025 at 11:14.
    Quote Quote  
  7. Originally Posted by marcorocchini View Post
    Code:
    clip=FFImageSource("v:\SMPTE bars .jpg")
    
    cropV=int(Fmod(clip.Width,2))
    
    clip=clip.crop(cropV,0,0,0)
    
    
    return (clip)
    
    
    #converttoYV24() #convert to planar
    converttoYV16() #convert to planar
    z_convertformat(interlaced=false,colorspace_op="170m:709:709:l=>709:709:709:l")
    ColorYUV(levels="PC->TV")
    ah wow Image
    [Attachment 86338 - Click to enlarge]


    but can tell to the z_convertformat

    in the "z_convertformat(interlaced=false,colorspace_op="1 70m:709:709:l=>709:709:709:l"" line

    to do what do the "ColorYUV(levels="PC->TV")" ? thanks
    See in your other thread how to convert your SMPTE bars .jpg
    https://forum.videohelp.com/threads/417936-comparting-frame-to-frame-in-edius-between-...th#post2771234

    You don't need colorYUV(levels= ....)

    Conversions are described here
    http://avisynth.nl/index.php/Avsresize
    Scroll down to the Examples.
    Last edited by Sharc; 28th Mar 2025 at 12:41.
    Quote Quote  
  8. ww thansk, I have modify to don't execute the line ColorYUV(levels="PC->TV")
    Quote Quote  
  9. A simple trick to crop one pixel off the width of a clip:

    Code:
    Crop(0,0,width/2*2,height)
    That will crop one pixel if the width is odd, do nothing if the width is even.

    For conversion to YV12 (YUV 4:2:0) you can do the same with the height.
    Quote Quote  
  10. ok but I wonder:

    can ffmpeg do the same thing of avisynth this

    Code:
    z_convertformat(interlaced=false,colorspace_op="170m:709:709:l=>709:709:709:l")
    colorspace conversion from 170m to 709?
    Quote Quote  
  11. Image
    [Attachment 86369 - Click to enlarge]


    I use

    Code:
    ffmpeg.exe -an -y -i "C:\Users\Administrator\Desktop\Nuova cartella (7)\SMPTE bars .jpg" -vf scale=w=-2:h=1080:in_range=tv:out_range=pc,colormatrix=bt470bg:bt709,pad="width=ceil(iw/2)*2:height=ceil(ih/2)*2" -frames:v 1 -update 1 -q:v 1 -huffman 1 -intra_matrix 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 -color_range 2 v:\ref.jpg
    to generate a ref.jpg OK (levels ok)

    but If I try to use the same line but with the final output file ref.TGA

    I get that: levels of ref.TGA are different to the ref.JPG, even if the commandline if the same


    Can Someone explain to the poor cat if is there a way to get the same levels?

    Image
    [Attachment 86370 - Click to enlarge]


    thanks
    Quote Quote  
  12. also have try

    Code:
    ffmpegOCT2024.exe  -an -v 32 -stats -loglevel fatal -y -i "C:\Users\Administrator\Desktop\Nuova cartella (7)\SMPTE bars .jpg" -vf zscale=w=-2:h=1080:f=spline36:r=full:d=ordered:in_range=tv:out_range=pc,colormatrix=bt470bg:bt709 -frames:v 1 -f image2 -update 1 -c:v targa -rle 0 uscitatarga.tga
    but the video levels between the previous output is the same
    Quote Quote  
  13. You change the levels range from TV(limited) to PC(full) or vice versa.

    When you do colorspace conversions you should be clear about
    1. The colorspace and range of the source
    2. How your source filter possibly affects the colorspace and range
    3. What exactly you want to do (from->to)
    4. Set up the conversion (avisynth, ffmpeg ......) accordingly, knowing what you are doing
    5. Watch the result using the correct matrix and range (decoder, renderer).

    If any of above is not clear your conversion becomes a surprise.
    Last edited by Sharc; 30th Mar 2025 at 04:39.
    Quote Quote  
  14. ffmpeg.exe -an -y -i "SMPTE bars .jpg" -vf scale=-2:1080,colormatrix=bt470bg:bt709 -sws_flags lanczos+accurate_rnd -frames:v 1 -f image2 -update 1 -c:v mjpeg -q:v 1 -huffman 1 -intra_matrix 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8 out.jpg

    I get a out.jpg file "raw 420 JFIF from .JPG"

    Can I get a 422 or 444 instead of 420?
    Quote Quote  
  15. Your source "SMPTE bars .jpg" from your other thread is 4:2:0.
    If you want 4:2:2 or 4:4:4 you need to upsample it, or use a 4:2:2 or 4:4:4 pixel format right from start.
    https://ffmpeg.org/ffmpeg-filters.html#allrgb_002c-allyuv_002c-color_002c-colorchart_0...02c-yuvtestsrc

    For 4:2:2 bars, for example
    Code:
    ffmpeg -f lavfi -i smptehdbars=duration=30:rate=25.0 -vf scale=1920:1080,setdar=16/9 -an -c:v utvideo -pix_fmt yuv422p "smpte_HDbars.avi"
    or in Avisynth, for 4:4:4
    Code:
    colorbarsHD(1920,1080,"YV24").
    (And what's the purpose of using the mjpeg encoder?)
    Last edited by Sharc; 30th Mar 2025 at 12:31. Reason: rate and DAR added to the ffmpeg commandline
    Quote Quote  
  16. Originally Posted by marcorocchini View Post
    levels of ref.TGA are different to the ref.JPG, even if the commandline if the same
    I get the same levels for both. The problem may be in the way your editor is interpreting them.
    Quote Quote  



Similar Threads

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