refactor: FFmpeg builder #36
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "builder"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal:
toString/buildshouldn't be doing much checks, just putting the ffmpeg commands togethertoStringlogic into multiple piecesThis PR have a lot more going on that a simple refactor. There is a lot of optimization and fixes that came from the new way of creating ffmpeg commands.
@ -37,6 +37,7 @@ const getFiles = async () => {}return true;}).filter((file) => file !== ".")Unrelated fix
1d26d5efa5toc34a8d1fc6good
@ -0,0 +427,4 @@// Pass-specific logicswitch (pass) {case 1: {args.push("-pass 1");Split: "-pass", "1"
@ -0,0 +443,4 @@return args.join(" ");}case 2: {args.push("-pass 2");Split: "-pass", "2"
@ -0,0 +476,4 @@this._metadata.forEach((m) => {args.push(`-metadata:s:${m.track.type.prefix}:${m.track.index}`,`${m.key}="${m.value}"`,We could have a toString function for Metadatas
@ -0,0 +379,4 @@if (FFmpegBuilder.changed(this._hw)) {let isVAAPI = this._hw === FFmpegArgument.HardwareBackend.VAAPI;// Common argumentsWhat is common?
@ -0,0 +397,4 @@}const bitrate = this._bitrates.find((s) => s.type === FFmpegArgument.Stream.Type.Video,Also as we wanna use the first video as reference, find index also based on index
@ -0,0 +431,4 @@// No audio in pass 1// https://trac.ffmpeg.org/wiki/Encode/H.264#Two-PassExampleargs.push("-vsync cfr");Split, "-vsync", "cfr"
@ -186,0 +218,4 @@),).audioCodec(FFmpegArgument.Codecs.Audio.AAC).profile(FFmpegArgument.Profile.Main)Is the profile really needed all the time? Does it help for compression? I remember that it was added during 10 bit support
@ -186,0 +219,4 @@).audioCodec(FFmpegArgument.Codecs.Audio.AAC).profile(FFmpegArgument.Profile.Main).tracks(FFmpegArgument.Tracks.AllVideos)Do we want all videos or only the first?
We were taking all the videos of the first input, and we probably will only ever encounter a file with one video stream.
WIP: FFmpeg builderto FFmpeg builderFor AMF, we could use -usage flag?
https://github.com/GPUOpen-LibrariesAndSDKs/AMF/wiki/AMF%20Encoder%20Settings%20and%20Tuning%20in%20FFmpeg#-usage
PR is mostly ready. Have to do some extensive testing as I rewrote ALL ffmpeg command using the new builder.
When ready, I think a squash will be welcome, as there is (too) many commits that are not worth being alone
A note for profile:
They were initially implemented but I removed them because :
FFmpeg builderto refactor: FFmpeg builder@ -182,0 +221,4 @@.input(file).output(finalFile).videoCodec(",".concat(...process.argv).includes("265")Do real argument parsing, don't mash all args to a string to do a basic string matching.
ajouter le AV1 tant qu'on y est