View Full Version : How to use vapoursynth with ffmpeg
poisondeathray
9th April 2013, 17:31
What is the syntax to get ffmpeg to encode with vapoursynth?
I can get it working with x264, but not ffmpeg
Does the output in the py still require y4m=true or something different ?
clip.output(sys.stdout, y4m=True)
Can someone please post an example of the cmd line
Thanks
sneaker_ger
11th April 2013, 13:10
Yes, it still requires that line.
Example:
python script.vpy | ffmpeg -f yuv4mpegpipe -i - output.mkv
poisondeathray
11th April 2013, 14:53
Thanks sneaker!
I tried many combinations, but the problem was I left the "-" at the end , as you do for x264 . DOH!
something like this:
python script.vpy | ffmpeg -f yuv4mpegpipe -i - output.mkv -
poisondeathray
11th April 2013, 16:04
Sneaker - how to pipe ffmpeg into ffmbc ?
Background: I'm testing effect of dithering from 16bit pngs . eg. various fmtconv settings in vapoursynth . ffmbc will accept 16bit png natively, and it does some sort of dithering when outputting 8bit YUV automatically, better than ffmpeg's pattern in the same scenario . The problem is it does a Rec601 conversion for 16bit RGB=>8bit YUV; and while you can use -vf colormatrix=bt601:bt709 in ffmbc, the quality isn't as good as doing it in 16bit and fmtcomv . (Of course, doing it all in fmtconv works good, but I just want to this for comparisons vs. fmtconv)
So the vpy script works fine when using ffmpeg by itself - but I want to pipe 16bit YUV input into ffmbc to control the higher quality RGB to YUV Rec709 conversion , to test ffmbc's 16bit YUV to 8bit YUV dithering
The 16bit pipe YUV pipe from vapoursynth appears to be preserved ("yuv444p16le") , but I get "At least one output file must be specified" and various other errors. I've tried a bunch of combinations with something like
test.vpy | ffmpeg -f yuv4mpegpipe -i - | ffmbc -f yuv4mpegpipe -i - -vcodec libx264 -crf 0 -an test.mp4
Changing recieving ffmbc into ffmpeg doesn't help (ie. I can't even pipe ffmpeg into ffmpeg)
sneaker_ger
11th April 2013, 16:28
You have to specify the input and output format:
ffmpeg -f yuv4mpegpipe -i - -f yuv4mpegpipe -
I don't know whether it works in ffmbc, though, and I don't see any need for piping through ffmpeg if you don't let ffmpeg manipulate the input in any way.
poisondeathray
11th April 2013, 16:37
You have to specify the input and output format:
ffmpeg -f yuv4mpegpipe -i - -f yuv4mpegpipe -
I don't know whether it works in ffmbc, though, and I don't see any need for piping through ffmpeg if you don't let ffmpeg manipulate the input in any way.
Thanks, it's not working with ffmpeg either
test.vpy | ffmpeg -f yuv4mpegpipe -i - -f yuv4mpegpipe - | ffmpeg -f yuv4mpegpipe -i - -vcodec libx264 -crf 0 -an test.mp4
.
.
.[yuv4mpegpipe @ 00032320] Stream #0: not enough frames to estimate rate; conside
r increasing probesize
[yuv4mpegpipe @ 00032320] Estimating duration from bitrate, this may be inaccura
te
Input #0, yuv4mpegpipe, from 'pipe:':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: rawvideo (Y3[0][16] / 0x10003359), yuv444p16le, 1280x720
, 23.98 tbr, 23.98 tbn, 23.98 tbc
[yuv4mpegpipe @ 0003d6e0] 'yuv444p16le' is not a official yuv4mpegpipe pixel for
mat. Use '-strict -1' to encode to this pixel format.
Output #0, yuv4mpegpipe, to 'pipe:':
Metadata:
encoder : Lavf54.61.104
Stream #0:0: Video: rawvideo (Y3[0][16] / 0x10003359), yuv444p16le, 1280x720
, q=2-31, 200 kb/s, 90k tbn, 23.98 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo -> rawvideo)
Could not write header for output file #0 (incorrect codec parameters ?): Invali
d argument
pipe:: Operation not permitted
.
.
.
ok
"[yuv4mpegpipe @ 0003d6e0] 'yuv444p16le' is not a official yuv4mpegpipe pixel for
mat. Use '-strict -1' to encode to this pixel format."
When I add -strict -1 , it says
At least one output file must be specified
pipe:: Operation not permitted
poisondeathray
11th April 2013, 16:43
I don't know whether it works in ffmbc, though, and I don't see any need for piping through ffmpeg if you don't let ffmpeg manipulate the input in any way.
Sorry , I didn't describe it very well above, but the reason is ffmbc won't accept the same 16bit yuv input from the vpy, whereas ffmpeg would . ffmbc sees the input from the vpy as 8bit yuv444p , and the output is messed up; I'm hoping piping it through ffmpeg will keep 16bit
sneaker_ger
11th April 2013, 16:57
Hmm, I just tried it myself and ffmbc does not even correctly recognize the 4:2:0 8bit pipe. Maybe we should try raw instead of y4m.
/edit:
it does work with 4:4:4 8bit y4m, but not with anything >8 bit it seems. Raw it is, I guess.
/edit2:
Yes, raw is working fine:
python script.vpy | ffmbc -f rawvideo -pix_fmt yuv444p16le -r 24000/1001 -s 1280x720 -i - -vcodec libx264 -preset medium -crf 18 output.mkv
Don't forget to turn y4m to False in the VapourSynth script.
poisondeathray
11th April 2013, 17:39
Thanks for the continued help sneaker
It works! At first it didn't work with y4m=false , so I removed that part completely
Do you know of any learning resources for ffmpeg piping and the different types of pipes , syntax,etc...? I tried digging up ffmpeg docs, but it's not very clear, no good examples
sneaker_ger
11th April 2013, 17:59
Not really.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.