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_!
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 1 of 1
Thread
-
Last edited by electron.rotoscope; 12th Feb 2019 at 16:41.
Similar Threads
-
can I set fixed size to video window
By mla in forum Video ConversionReplies: 2Last Post: 20th Oct 2018, 08:34 -
ffmpeg nvenc command
By hanaluluelle in forum Video ConversionReplies: 8Last Post: 27th Jul 2017, 02:42 -
faster ffmpeg video/audio encodes for nvenc/loudnorm ?
By hydra3333 in forum Video ConversionReplies: 1Last Post: 14th Jan 2017, 05:39 -
Encode for Target Size Fixed!!
By Cauptain in forum Video ConversionReplies: 13Last Post: 21st Oct 2016, 15:32 -
ffmpeg and hevc_qsv encodes a single file only
By Epaminaidos in forum Video ConversionReplies: 9Last Post: 23rd Sep 2016, 13:06