Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Newbies

Reply
 
Thread Tools Search this Thread Display Modes
Old 9th April 2013, 17:31   #1  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,807
How to use vapoursynth with ffmpeg

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
poisondeathray is offline   Reply With Quote
Old 11th April 2013, 13:10   #2  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,370
Yes, it still requires that line.

Example:
python script.vpy | ffmpeg -f yuv4mpegpipe -i - output.mkv
sneaker_ger is offline   Reply With Quote
Old 11th April 2013, 14:53   #3  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,807
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 is offline   Reply With Quote
Old 11th April 2013, 16:04   #4  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,807
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)

Last edited by poisondeathray; 11th April 2013 at 16:24.
poisondeathray is offline   Reply With Quote
Old 11th April 2013, 16:28   #5  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,370
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.
sneaker_ger is offline   Reply With Quote
Old 11th April 2013, 16:37   #6  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,807
Quote:
Originally Posted by sneaker_ger View Post
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

Code:
test.vpy | ffmpeg -f yuv4mpegpipe -i - -f yuv4mpegpipe - | ffmpeg -f yuv4mpegpipe -i - -vcodec libx264 -crf 0 -an test.mp4
Quote:
.
.
.[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 is offline   Reply With Quote
Old 11th April 2013, 16:43   #7  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,807
Quote:
Originally Posted by sneaker_ger View Post
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

Last edited by poisondeathray; 11th April 2013 at 16:46.
poisondeathray is offline   Reply With Quote
Old 11th April 2013, 16:57   #8  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,370
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.

Last edited by sneaker_ger; 11th April 2013 at 17:23.
sneaker_ger is offline   Reply With Quote
Old 11th April 2013, 17:39   #9  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,807
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

Last edited by poisondeathray; 11th April 2013 at 17:46.
poisondeathray is offline   Reply With Quote
Old 11th April 2013, 17:59   #10  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,370
Not really.
sneaker_ger is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:55.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.