VideoHelp Forum
+ Reply to Thread
Results 1 to 1 of 1
Thread
  1. I have a recurring need to encode videos that are under 10 MB in length for compatibility with an old system. Sometimes I get source media that's as short as 30 seconds, sometimes as long as 90 seconds.

    I've been using the duration to calculate the bitrate and then do a 2 pass x264 encode in ffmpeg setting -b:v at my best guess and checking afterwards, but is there something I can run on a Windows commandline batch file that would somehow detect the length and then I could program it to determine the bitrate?

    EDIT:

    I think I've figured this out with ffprobe, but in case anyone else is looking, this is the rough method I've used (within a for loop, so enabledelayedexpansion)

    Code:
    ffprobe.exe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "infile" > proberesults.temp 2> probeerrors.temp
    <nul set /p =PROBED DURATION: 
    type proberesults.temp
    <nul set /p =PROBE ERRORS: 
    type probeerrors.temp
    <nul set /p _duration_= < proberesults.temp
    <nul set /a _kbps_=targetsizeinkiloBITS/_duration_
    <nul set /p =BITRATE: 
    echo !_kbps_!
    Last edited by electron.rotoscope; 12th Feb 2019 at 16:41.
    Quote Quote  



Similar Threads

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