VideoHelp Forum
+ Reply to Thread
Results 1 to 11 of 11
Thread
  1. Member wwaag's Avatar
    Join Date
    Jan 2002
    Location
    Olympic Peninsula, US
    Search Comp PM
    I am trying to pipe AVS scripts to the 64 bit version of FFmpeg for x264 encoding using avs2yuv. My problem is 2 pass encoding. Without piping, it works fine. Here's an example of the code I'm using.

    Code:
    ffmpeg  -y  -i <inAVS>  -c:v libx264  -b:v 6000k  -pass 1 -preset medium -an  -f mp4 NUL &&\ 
    ffmpeg -i <inAVS>  -itsoffset 0.045 -i <inTempWav> -map 0:0 -map 1:0  -c:v libx264  -b:v 6000k  -pass 2 -preset medium -c:a aac -b:a 256k  <outFile>.mp4
    For single pass encoding using avs2yuv, no problem. Here's an example.

    Code:
    avs2yuv <inAVS> - | ffmpeg -y -f yuv4mpegpipe -i -  -c:v libx264  -crf 23 -preset medium -an  <outFile>.mp4
    However, for two pass encoding, I cannot get it to work. Here's the code I'm using.

    Code:
    avs2yuv <inAVS> - | ffmpeg -y -f yuv4mpegpipe -i -  -c:v libx264  -b:v 6000k  -pass 1 -preset medium -an  -f mp4 NUL &&\ 
    avs2yuv <inAVS> - | ffmpeg -f yuv4mpegpipe -i -  -c:v libx264  -b:v 6000k  -pass 2 -preset medium -an  <outFile>.mp4
    In the log file I get this error message--Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

    I suspect the problem has to do with how the log file is being set up during pass 1. Any help would be appreciated. Thanks.

    wwaag
    Quote Quote  
  2. Try x264-params to specify the pass and log

    This works for me on windows

    Code:
    avs2yuv INPUT.avs - | ffmpeg -y -f yuv4mpegpipe -i -  -c:v libx264  -b:v 6000k  -x264-params pass=1:stats="log.log" -preset medium -an  -f mp4 NUL
    avs2yuv INPUT.avs - | ffmpeg -f yuv4mpegpipe -i -  -c:v libx264  -b:v 6000k  -x264-params pass=2:stats="log.log" -preset medium -an OUTPUT.mp4
    Last edited by poisondeathray; 9th Mar 2017 at 13:47.
    Quote Quote  
  3. Another option is piping 32bit ffmpeg (if you are using 32bit avs) to 64bit ffmpeg . Pipe speed is about 15-25% faster than avs2yuv


    I get about 390-400fps on this avs with avs2yuv
    Code:
    avs2yuv input.avs - | ffmpeg -f yuv4mpegpipe -i - -c:v rawvideo -an -f null NULL
    I get about 500-510fps on this avs with ffmpeg32 to ffmpeg
    Code:
    ffmpeg32 -i input.avs -f yuv4mpegpipe - | ffmpeg -f yuv4mpegpipe -i - -c:v rawvideo -an -f null NULL
    That's just pipe speed as measured by the 2nd ffmpeg instance; but how that actually translates into final encoding speed difference is another question - that involves many other factors, but it should be higher theoretically
    Last edited by poisondeathray; 9th Mar 2017 at 14:02.
    Quote Quote  
  4. You can try to set log file explicitly (part of my script):
    first pass
    Code:
    -pass:v:0 1 -passlogfile:v:0 log_%~n1
    second pass
    Code:
    -pass:v:0 2 -passlogfile:v:0 log_%~n1
    Quote Quote  
  5. Member wwaag's Avatar
    Join Date
    Jan 2002
    Location
    Olympic Peninsula, US
    Search Comp PM
    Thanks guys but no cigar.

    Here is code suggested by pdr
    Code:
    avs2yuv <inAVS> - | ffmpeg -y -f yuv4mpegpipe -i -  -c:v libx264  -b:v 6000k  -x264-params pass=1:stats="log.log"  -preset medium -an  -f mp4 NUL &&\ 
    avs2yuv <inAVS> - | ffmpeg -f yuv4mpegpipe -i -  -c:v libx264  -b:v 6000k -x264-params pass=2:stats="log.log" -preset medium -an  <outFile>.mp4
    and pandy
    Code:
    avs2yuv <inAVS> - | ffmpeg -y -f yuv4mpegpipe -i -  -c:v libx264  -b:v 6000k -pass:v:0 1 -passlogfile:v:0 log_%~n1  -preset medium -an  -f mp4 NUL &&\ 
    avs2yuv <inAVS> - | ffmpeg -f yuv4mpegpipe -i -  -c:v libx264  -b:v 6000k -pass:v:0 2 -passlogfile:v:0 log_%~n1-preset medium -an  <outFile>.mp4
    and here is the error message I get from the log file--same for both cl's.

    Code:
    2017/03/09  13:50:18  --ffmpeg version N-83657-g7e4f32f Copyright (c) 2000-2017 the FFmpeg developers
    2017/03/09  13:50:18  --  built with gcc 6.3.0 (GCC)
    2017/03/09  13:50:18  --  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
    2017/03/09  13:50:18  --  libavutil      55. 47.100 / 55. 47.100
    2017/03/09  13:50:18  --  libavcodec     57. 81.100 / 57. 81.100
    2017/03/09  13:50:18  --  libavformat    57. 66.102 / 57. 66.102
    2017/03/09  13:50:18  --  libavdevice    57.  2.100 / 57.  2.100
    2017/03/09  13:50:18  --  libavfilter     6. 74.100 /  6. 74.100
    2017/03/09  13:50:18  --  libswscale      4.  3.101 /  4.  3.101
    2017/03/09  13:50:18  --  libswresample   2.  4.100 /  2.  4.100
    2017/03/09  13:50:18  --  libpostproc    54.  2.100 / 54.  2.100
    2017/03/09  13:50:18  --Input #0, yuv4mpegpipe, from 'pipe:':
    2017/03/09  13:50:18  --  Duration: N/A, start: 0.000000, bitrate: N/A
    2017/03/09  13:50:18  --    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p(progressive), 1920x1080, 59.94 fps, 59.94 tbr, 59.94 tbn, 59.94 tbc
    2017/03/09  13:50:18  --[libx264 @ 00000000001e87c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    2017/03/09  13:50:18  --[libx264 @ 00000000001e87c0] ratecontrol_init: can't open stats file
    2017/03/09  13:50:18  --Stream mapping:
    2017/03/09  13:50:18  --  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
    2017/03/09  13:50:18  --Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
    2017/03/09  13:50:18  --C:\Users\Wayne\Documents\HappyOtterScripts for Vegas\FFmpeg Renders\QuickRender.avs: 1920x1080, 60000/1001 fps, 300 frames
    2017/03/09  13:50:18  --error: wrote only 3084509 of 3110400 bytes
    Suggestions? Thanks.

    wwaag
    Quote Quote  
  6. Originally Posted by wwaag View Post

    Suggestions? Thanks.
    Code:
    avs2yuv <inAVS> - | ffmpeg -y -f yuv4mpegpipe -i - -c:v libx264  -b:v 6000k -pass:v:0 1 -passlogfile:v:0 log_pipe -preset medium -an  -f mp4 NUL &&\ 
    avs2yuv <inAVS> - | ffmpeg -f yuv4mpegpipe -i - -c:v libx264  -b:v 6000k -pass:v:0 2 -passlogfile:v:0 log_pipe -preset medium -an  <outFile>.mp4
    Will this work?
    Quote Quote  
  7. Member wwaag's Avatar
    Join Date
    Jan 2002
    Location
    Olympic Peninsula, US
    Search Comp PM
    I think I may have solved it with the following code. I simply changed the "log.log" to a real file name "F:\x264.log". It does the 2 passes although I never see the x264.log file being created. Here is the revised code:

    Code:
    avs2yuv <inAVS> - | ffmpeg -y -f yuv4mpegpipe -i -  -c:v libx264  -b:v 6000k  -x264-params pass=1:stats="F:\x264.log"  -preset medium -an  -f mp4 NUL &&\ 
    avs2yuv <inAVS> - | ffmpeg -f yuv4mpegpipe -i -  -c:v libx264  -b:v 6000k -x264-params pass=2:stats="F:\x264.log" -preset medium -an  <outFile>.mp4
    @pdr. Didn't know you could pipe from one version of FFmpeg to another. I'll do some test encodes comparing actual frameserved renders from Vegas. One other question. Is there a way to pipe into Vdub 64 from frameserved (Debugmode) output from Vegas? No problem with 32bit Vdub, but 64 bit vdub won't open the signpost file directly or a 32 bit avs script. Avs2yuv has a huffy output option, but I cannot find a decoder for the FFVH codec. Any suggestions would be appreciated or should I start a new topic? Thanks.

    wwaag
    Quote Quote  
  8. Member wwaag's Avatar
    Join Date
    Jan 2002
    Location
    Olympic Peninsula, US
    Search Comp PM
    @pandy

    Code:
    avs2yuv <inAVS> - | ffmpeg -y -f yuv4mpegpipe -i -  -c:v libx264  -b:v 6000k  -pass:v:0 1 -passlogfile:v:0 log_pipe -preset medium -an  -f mp4 NUL &&\ 
    avs2yuv <inAVS> - | ffmpeg -f yuv4mpegpipe -i -  -c:v libx264  -b:v 6000k  -pass:v:0 2 -passlogfile:v:0 log_pipe -preset medium -an  <outFile>.mp4
    Still doesn't work.
    Quote Quote  
  9. Originally Posted by wwaag View Post
    Is there a way to pipe into Vdub 64 from frameserved (Debugmode) output from Vegas? No problem with 32bit Vdub, but 64 bit vdub won't open the signpost file directly or a 32 bit avs script. Avs2yuv has a huffy output option, but I cannot find a decoder for the FFVH codec. Any suggestions would be appreciated or should I start a new topic? Thanks.
    I don't know of any, maybe 64bit avs, not sure. 64bit avisynth plus is more complete these days, almost all filters are available. (That's avsynth+)

    Actually avfs should be able to; you would use 32bit avs as normal, but mount the avs. The "dummy" avi generated is compatible in all windows programs 64bit or 32bit .

    But the more frameservers you have working the worse the performance. Massive overhead when you start chaining up a few. Sometimes it's just better to use a physical intermediate
    Quote Quote  
  10. @wwaag
    Do you have writing rights in the directory you are working in?
    Quote Quote  
  11. Member wwaag's Avatar
    Join Date
    Jan 2002
    Location
    Olympic Peninsula, US
    Search Comp PM
    Do you have writing rights in the directory you are working in?

    Good question. Apparently, that was the problem all along. Changed the host program (Vegas) to run as admin and all three suggested approaches by pdr and pandy worked. That also explains why changing the location to another directory also worked. Thanks so much to all of you.

    @pdr. I did a test run with the avfs.dll a few days ago and it does work. You make a good point about any time savings over a direct render. Will do some testing.

    wwaag
    Quote Quote  



Similar Threads

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