VideoHelp Forum
+ Reply to Thread
Results 1 to 5 of 5
Thread
  1. Hi cats

    from my nle I'have export my video that have duration of 1 hour and 12 minutes (video.avi)

    This video.avi is uncompressed YUV 4:2:2 1920x1080 25fps interlace and is 465 GB
    The audio track is separated file from the video, audio.wav is a uncompressed PCM L+R audio file of 800 MB

    I would like do a transcoding into a unique .mp4 file that fit a DVD of 4,7 GB so I need to encode so that the file size does not exceed the 4,5GB (I use the dvd only to save the file, not a dvd-video)

    In the meantime I need this charateristics in the target .mp4 file:

    - deinterlace (possibly using the yadif) and double framerate from 25fps interlaced to 50 progressive
    - reduce the colorspace from 4:2:2 to 4:2:0
    - reduce audio to a .mp3 or .aac codec 48Khz and 320 Kpbs
    - use ffmpeg as transcoder, and X264
    - use the variable bitrate for video
    - use the 2° pass encoding

    Please cats, what have to be the commandline of ffmpeg that do all this? thanks
    Last edited by marcorocchini; 2nd Sep 2016 at 05:10.
    Quote Quote  
  2. https://trac.ffmpeg.org/wiki/Encode/H.264#twopass


    I use something like this to perform dualpass - i modify script but not tested to match your requirement with separate audio file, yadif or nnedi can be add to vproc line

    Code:
    @setlocal
    @set gop=240
    @set vbitrate=2413
    @set /a vbuffsiz=%vbitrate%*1
    @set /a vmaxrate=20000*1
    
    @set slice=0
    @SET x264opts1="bitrate=%vbitrate%:vbv_maxrate=%vmaxrate%:vbv_bufsize=%vbuffsiz%:level=4.0:keyint=%gop%:qpmin=4:cabac=1:threads=auto:sliced_threads=0:slices=%slice%:tff=1:interlaced=0:fake-interlaced=1:no_psnr=1:no_ssim=1:bluray_compat=1:open-gop=0:pic_struct=1:aud=1:nal_hrd=vbr:force_cfr=1:fullrange=off:overscan=show:colorprim=bt709:transfer=bt709:colormatrix=bt709:fastfirstpass=1"
    @SET x264opts2="bitrate=%vbitrate%:vbv_maxrate=%vmaxrate%:vbv_bufsize=%vbuffsiz%:level=4.0:keyint=%gop%:qpmin=4:cabac=1:threads=auto:sliced_threads=0:slices=%slice%:tff=1:interlaced=0:fake-interlaced=1:no_psnr=1:no_ssim=1:bluray_compat=1:open-gop=0:pic_struct=1:aud=1:nal_hrd=vbr:force_cfr=1:fullrange=off:overscan=show:colorprim=bt709:transfer=bt709:colormatrix=bt709"
    
    
    @set vproc=scale=iw:ih:sws_flags=neighbor:sws_dither=0:in_range=1:out_range=1,pp=ac/dr,format=pix_fmts=yuv420p
    @set aproc=aresample=resampler=soxr:osr=48000:dither_method=0
    
    @ffmpeg.exe -y -hide_banner -loglevel 32 -stats -avoid_negative_ts 1 -i "%1" -c:v libx264 -b:v %vbitrate%k -preset:v veryslow -tune:v film -profile:v high -level:v 4.0 -x264opts:v %x264opts1% -x264-params:v %x264opts1% -pass:v 1 -passlogfile:v log_%~n1 -color_range:v 2 -pix_fmt:v yuv420p -vf %vproc% -i "%2" -af %aproc% -c:a aac -b:a 320k -shortest -movflags faststart -y -f mp4 NUL
    @ffmpeg.exe -y -hide_banner -loglevel 32 -stats -avoid_negative_ts 1 -i "%1" -c:v libx264 -b:v %vbitrate%k -preset:v veryslow -tune:v film -profile:v high -level:v 4.0 -x264opts:v %x264opts2% -x264-params:v %x264opts2% -pass:v 2 -passlogfile:v log_%~n1 -color_range:v 2 -pix_fmt:v yuv420p -vf %vproc% -i "%2" -af %aproc% -c:a aac -b:a 320k -shortest -movflags faststart -y -f mp4 %~n1_.mp4
    @endlocal
    Quote Quote  
  3. oky thanks but how can modify the commandline to fit the final size into the target of 4,5 GB?
    Last edited by marcorocchini; 2nd Sep 2016 at 07:20.
    Quote Quote  
  4. Originally Posted by marcorocchini View Post
    oky thanks but how can modify the commandline to fit the final size into the target of 4,5 GB?
    Calculate bitrate and place calculated bitrate in line @set vbitrate=2413 (1kbps=1000bits) - this is for video only so sum of audio bitrate (320kbps) and small container overhead (assume 0.5%) with video must fit in desired target size (divided by number of seconds) - i have libreoffice calc sheet to do such thing but currently have no access to my desk computer - i hope it should but too chalenging for you to calculate required bitrate (there are some online bitrate calculators AFAIR).
    Quote Quote  
  5. Universal:

    Code:
    file size = bitrate * running time
    plus a little overhead for the container. If you can't do the math use a bitrate calculator.
    Quote Quote  



Similar Threads

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