Log in

View Full Version : Problem saving 16bit tiff file using RGB format


MonoS
29th January 2015, 13:05
Hi, i'm trying to save some image in a 16bit tiff file after some postprocessing using vs.

this is the script

import vapoursynth as vs

core = vs.get_core()

src = core.d2v.Source("D:/Download/VTS_04_1.d2v", nocrop=False).std.Trim(0,0)

crop = core.std.CropRel(src, 72, 72, 60, 60)
crop = core.fmtc.bitdepth(crop, bits=16)

up = core.nnedi3.nnedi3_rpow2(crop, 4, correct_shift=True, nsize=3, nns=4, qual=2)

res = core.fmtc.resample(up, 630,456, kernel="Spline64", css="444")

conv = core.fmtc.matrix(res, mat="601", fulls=False, fulld=True, csp=vs.RGB48)

#fin = core.fmtc.bitdepth(conv, bits=8, dmode=7,fulls=True, fulld=True)

conv.set_output()


While waiting for the correct version of imwri, i tried saving images using ffmpeg [and also imagemagick]

I used this

vspipe.exe file.vpy - | ffmpeg.exe -f rawvideo -pix_fmt rgb48 -s 630x456 -i - test.tiff


The output image is this one http://www.mediafire.com/view/mhuzt98u7nc8uht/incorrect.tiff
The same thing happen with rgb24.

Instead if i don't convert to rgb and pass the yuv44416 stream to ffmpeg it output the correct image [ http://www.mediafire.com/view/th7sjgao5rxhp85/correct.tiff ] but give me some warning on swscaler and about chroma interpolation.

What could be the problem??

jackoneill
29th January 2015, 13:29
With this script, the output of vspipe is planar RGB. ffmpeg's "rgb48" format is packed.

Try "-pix_fmt gbrp16le" and


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


before set_output().

MonoS
29th January 2015, 13:50
Ok, now it works :D [but still give me the warning about chroma interpolation, that AFAIK i shouldn't care]

Thank you jackoneill