VideoHelp Forum
+ Reply to Thread
Results 1 to 23 of 23
Thread
  1. it's closer to what i want compared to vapoursynth's .mov output.
    Last edited by vvbb; 25th Apr 2020 at 15:02.
    Quote Quote  
  2. You're probably overcomplicating things

    What are you using avisynth or vapoursynth for ?

    original source was .mp4 and its codec was 4:2:0 yuv
    PS can open most types of AVC in MP4 natively . If it's a MKV , remux it to MP4
    Quote Quote  
  3. is it okay if I message you?
    Quote Quote  
  4. Originally Posted by vvbb View Post
    is it okay if I message you?
    Yes

    -----

    The BG info is some resizing and filters being applied;


    I'm going to answer here in case someone else has the same problem:

    If you are sending something to photoshop , it works in RGB . It doesn't make sense to convert to YUV444 then back to YUV420 . You minimize the loss if you convert once to some RGB format for import

    RGB doesn't compress very well. If you want lossless 8bit RGB, the filesizes are going to be large.

    The common formats for RGB in MOV container that PS supports are PNG in MOV, and QTRLE in MOV. PNG offers lossless compression, so the filesizes will be smaller than QTRLE

    So the output node of the vpy script should be RGB24 (assuming you don't want alpha channel, piping is slightly different if you need to pipe alpha channel)

    You would pipe rawvideo with vspipe. RGB24 planar in ffmpeg is "gbrp"

    It would look like this. Enter the values for width, height, framerate
    Code:
    vspipe input.vpy - | ffmpeg -f rawvideo -pix_fmt gbrp -s <widthxheight> -r <framerate> -i - -c:v png -an output.mov
    Quote Quote  
  5. I don't know if this works on the Mac version of PS , but you can try using AVFS to mount a "virtual" AVI , using the VPY script.

    It works on PS windows; but because this "looks" like uncompressed RGB24 AVI, I think it might work on a Mac as well . The benefit would be no large intermediate files. Worth a try.
    Quote Quote  
  6. vspipe: Invalid argument
    Last edited by vvbb; 25th Apr 2020 at 15:03.
    Quote Quote  
  7. Select "no header" instead of Y4M . Because you are piping "rawvideo"

    Since you are using vsedit ( the editor GUI) to encode, the arguments box would look like

    Code:
    -f rawvideo -pix_fmt gbrp -s 800x500 -r 30 -i - -c:v png -an -y /Users/vvbb/vapoursynth/output/output.mov

    In windows, it looks like vsedit is swapping the R,G,B channels in different order when it's piping

    If the colors look "wrong" in the output file, almost like a "negative", you might have to add to your script

    clip = core.std.ShufflePlanes(clip, planes=[1,2,0], colorfamily=vs.RGB)

    Using vspipe directly does not have the problem
    Quote Quote  
  8. Post your full script . The output node should be RGB24 before pipe

    What does this report about your script

    Code:
    vspipe --info test.vpy -
    Quote Quote  
  9. Thank you for the continued help
    Last edited by vvbb; 25th Jan 2020 at 10:39.
    Quote Quote  
  10. Thank you for the continued help
    Last edited by vvbb; 25th Jan 2020 at 10:40.
    Quote Quote  
  11. When using command lines directly, you would do it from terminal, not vsedit

    I think vsedit is adding the ffmpeg .
    Command line:
    "/usr/local/bin/ffmpeg" vspipe --info test.vpy -

    Frames: 120 | Time: 0:00:04.009 | Size: 800x500 | FPS: 59925/2002 = 29.9326 | Format: RGB24
    But the script, and this info from vsedit is enough

    Note the framerate is "non standard" 29.9326 ; might be a source filter issues, or what is the source video ? VFR ? . This might indicate other issues



    The shuffleplanes would have to come after converting to RGB24, because you're changing the order of R,G,B

    Code:
    video = core.fmtc.resample(video, css="444")
    video = descale.Debilinear(video, 896,504)
    
    video = core.resize.Bicubic(video, format=vs.RGB24, matrix_in_s="709")
    video = core.std.ShufflePlanes(video, planes=[1,2,0], colorfamily=vs.RGB)
    And your dimensions are 896 x 504 after debilinear , why does it report Size: 800x500 ? Doesn't add up

    If the color is "off" try taking out the ShufflePlanes
    Quote Quote  
  12. this works for me, encoding directly in vapoursynth:
    Code:
    import vapoursynth as vs
    from vapoursynth import core
    import subprocess
    
    ffmpeg = r'C:\path\ffmpeg.exe'
    destination = r'F:\output.mov'
    clip = core.ffms2.Source(r'C:/video.mp4')
    
    #frames
    start = 0
    end   = 30
    
    clip=clip[start:end]
    
    def progress(current, total):
        print(f'{current},{total}  ', end = '\r')
    
    cmd = [
            ffmpeg,
            '-i', '-',
            '-y',
            '-f', 'rawvideo', 
            '-pix_fmt',  'gbrp',
            '-s', f'{clip.width}x{clip.height}',
            '-r', f'{clip.fps}',
            '-c:v', 'png',
            '-an',
            destination
          ]
    process = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
    clip.output(process.stdin, y4m=True, progress_update=progress) 
    process.communicate()
    Quote Quote  
  13. Thank you for the continued help
    Last edited by vvbb; 25th Apr 2020 at 15:04.
    Quote Quote  
  14. Originally Posted by vvbb View Post
    the source video is 1280x720 .mp4

    the 896x504 is what i resized it to (i'm not sure how to explain) but the dimensions of the file are still 800x500
    Is the preview 896x504 in vsedit ?

    Did you change the commandline to reflect the actual dimensions (not 800x500)


    Code:
    -f rawvideo -pix_fmt gbrp -s 896x504 -r 30 -i - -c:v png -an -y /Users/vvbb/vapoursynth/output/output.mov

    when I take out the shuffleplanes line, the output video info says the Format: YUV444P8. I kept the same arguments but the color is still off
    Not possible; this line converts to RGB

    video = core.resize.Bicubic(video, format=vs.RGB24, matrix_in_s="709")

    I think you have mixed up the order somewhere
    in terminal, it says vspipe: command not found
    You need the correct path, from wherever vspipe is on your system
    Quote Quote  
  15. Thank you for the continued help
    Last edited by vvbb; 25th Apr 2020 at 15:04.
    Quote Quote  
  16. Originally Posted by vvbb View Post
    in preview in vs edit, the size is 800x500
    Post your FULL script. Everything. Source filter. Everything



    with these lines

    video = core.std.ShufflePlanes(video, planes=[1,2,0], colorfamily=vs.RGB)
    video = core.resize.Bicubic(video, format=vs.RGB24, matrix_in_s="709")

    I get Resize error 1026: RGB color family cannot have YUV matrix coefficients

    and

    video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
    Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

    Wrong order . Again, ShufflePlanes has to come AFTER you 've converted to RGB . See post #11

    Code:
    video = core.resize.Bicubic(video, format=vs.RGB24, matrix_in_s="709")
    video = core.std.ShufflePlanes(video, planes=[1,2,0], colorfamily=vs.RGB)
    Quote Quote  
  17. ..
    Last edited by vvbb; 21st Jul 2020 at 14:49.
    Quote Quote  
  18. Originally Posted by vvbb View Post
    thank you. it encoded properly, but there's still a noticeable difference between this output versus an .avi one

    but at this point (clearly in over my head), I suppose I just want to know what the reason for that is

    much appreciated

    In what way? Describe the difference

    That MOV should look identical to what you see in vsedit preview




    Was the script for the AVI different using avisynth ? There is a lot of missing information you have not provided . For example, the avs script

    And the dimension discrepancy and framerate issue in vapoursynth - there's more going on here than you're describing. Things are not adding up, or you haven't provided enough info
    Quote Quote  
  19. Originally Posted by vvbb View Post
    video = descale.Debilinear(video, 896,504)
    Note that "debilinear" has a specific purpose - to "undo" a bilinear upscale . If this is not your case, you will probably not get the desired outcome



    Originally Posted by vvbb View Post
    resamplehq(srcmatrix="TV.709",dstcolorspace="RGB32 ")

    If it was "resamplehq" (gamma aware scaling) in the AVS , there is a resamplehq for vapoursynth too.
    http://vsdb.top/plugins/resamplehq


    Enter the output width , output height in the 2nd line

    import resamplehq
    .
    .
    video = resamplehq.resample_hq(video, width=width, height=height)
    .
    .
    #You might have to change to RGB24 if piping RGB out. I think resample_hq changes back to the input pixel format automatically
    .
    .
    video = core.resize.Bicubic(video, format=vs.RGB24, matrix_in_s="709")
    #if the colors are "wrong" add the ShufflePlanes





    Or you can do it with the default Resize by using srgb to linear for the transfer, apply the resize, Then linear back to srgb for the final RGB24 format

    Enter the output width , output height in the 2nd line

    video = core.resize.Bicubic(video, format=vs.RGBS, matrix_in_s="709", transfer_in_s="srgb", transfer_s="linear")
    video = core.resize.Bicubic(video, format=vs.RGBS, width=width, height=height)
    video = core.resize.Bicubic(video, format=vs.RGB24, transfer_in_s="linear", transfer_s="srgb")



    If you want more help post the full AVS and VPY scripts
    Quote Quote  
  20. thanks
    Last edited by vvbb; 25th Jan 2020 at 10:41.
    Quote Quote  
  21. That screenshot difference cannot be explained from resamplehq. It might be differences in debilinear algorithm; the avs version is closed source, vpy version open . That would be the most likely explanation

    http://avisynth.nl/index.php/Debilinear
    https://github.com/Irrational-Encoding-Wizardry/vapoursynth-descale

    Those are your only 2 filters . The other possibility is some decoding issue or difference from source filter (unlikely)

    If you upload a source sample, with your exact script (dimensions, not just variables), I can check to see why there is a difference and what you can do about it


    or...

    quicktime converted the .avi files I had saved into .mov, and i imported them into photoshop that way to compare again. it's closer to what i want compared
    If you still have the AVI files - Why not just convert those?

    What does mediainfo(view=>text) or ffmpeg say about the AVI files?

    If they are already RGB , it might be as simple as

    ffmpeg -i input.avi -c:v png output.mov

    And ffmpeg is easily batchable

    But rv24 is uncommon, there might be other issues. If you are having problems with that, upload a cut sample of that AVI
    Quote Quote  
  22. thanks!
    Last edited by vvbb; 25th Jan 2020 at 10:42.
    Quote Quote  
  23. I can see the difference. But I'm not sure why you would want the avs version - it has more line artifacts, for example in the water . The main difference is due to the debilinear version differences

    If you just compare just the first step - the RGB conversion using resamplehq in avs vs. Using different types, different settings, they are pretty close.

    By default, avs resamplehq uses spline36 for Y, and bilinear for CbCr resizing. You are not resampling the Y in that script with resamplehq. But you can specify the same kernals and chroma locations in vapoursynth too. (Avs resizers use different chroma interpolation by default, preserving the center) . But those differences are minor compared to the debilinear differences.

    Those characteristic artifacts only appear when avs debilinear is applied. As mentioned earlier, the avs version is closed source, so I don't know how to emulate it exactly . You can import avs scripts and load avs .dll's in vapoursynth, but you might have problems on a mac with that (not sure)
    Quote Quote  



Similar Threads

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