it's closer to what i want compared to vapoursynth's .mov output.
+ Reply to Thread
Results 1 to 23 of 23
-
Last edited by vvbb; 25th Apr 2020 at 15:02.
-
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 -
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
-
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. -
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 -
Post your full script . The output node should be RGB24 before pipe
What does this report about your script
Code:vspipe --info test.vpy -
-
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
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)
If the color is "off" try taking out the ShufflePlanes -
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()
-
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
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 -
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)
-
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 -
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
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 -
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...
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 -
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)
Similar Threads
-
wmv Avisynth/Vapoursynth?
By Selur in forum Newbie / General discussionsReplies: 0Last Post: 5th Sep 2019, 13:59 -
Can i use AviSynth plugins in vapoursynth?
By zanzar in forum Newbie / General discussionsReplies: 16Last Post: 13th Feb 2019, 08:37 -
Avisynth equivalent plugins for vapoursynth
By zanzar in forum Newbie / General discussionsReplies: 4Last Post: 4th Feb 2019, 11:58 -
Help transitioning from avisynth to vapoursynth.
By zanzar in forum Newbie / General discussionsReplies: 10Last Post: 3rd Feb 2019, 16:50 -
Debading method (Vapoursynth to avisynth)
By frank_zappa in forum RestorationReplies: 2Last Post: 3rd Nov 2017, 12:26