Comment by thegrim33

1 year ago

Not trying to be too negative but the memories your comment brought up in me, I need to rant about ffmpeg for a minute. ffmpeg is the worst documented major library I've ever used in my life. I integrated with it to render videos inside my 3D engine and boy do I shiver at any thought of having to work with it again.

The "documentation" is a collect of 15-20 year old source samples. The vast majority of them either won't compile anymore because the API has changed, or they use 2, 3, or 4 times deprecated functions that shouldn't be used anymore. The source examples also have almost no comments explaining anything. They have super dense, super complicated code, with no comments, but then there will be a line like "setRenderSpeed(3)" or whatever and it'll have a comment: "Sets render speed to 3", the absolute most useless comment ever. The source examples are also all written in 30 year old as C-Style of C code as you can get, incredibly horribly dense, with almost no organization, have to jump up and down all over the file to find the global variables being accessed, it's just gross and barely comprehensible.

They put a lot of effort into producing doxygen documentation for everything, but the doxygen documentation is nearly useless, it just lists the API with effectively zero documentation or explanation on the functions or parameters. There's so little explanation of how to do anything. On the website they have sections for each library, and for most libraries you get 2-3 sentences of explanation on what the library is for, and that's it. That's the extent the entire library is documented. They just drop an undocumented massive C API split across a dozen or so libraries on you and wish you luck.

The API has also gotten absolutely wrecked over the last 20 years or however long it's been around as it has evolved. Sometimes they straight up delete functions to deprecate them, sometimes they create a new version of a function as fuction2 and then as function3, and keep all of them around, sometimes they replace a function with a completely differently named function and keep them both around, and there's absolutely nothing written anywhere about what the "right" way to do anything is, what functions you should actually be using. So many times I went down rabbit holes reading some obscure 15 year old mailing list post trying to find anyone that had successfully done something I was trying to do. And again, the obscure message board posts and documentation that does exist is almost all deprecated at this point and shouldn't be used.

Then there's the custom build system, so if you need to build it custom to support or not support different features, you can't use any modern build system, it's all custom scripts that do weird things like hardcoded dumping build output into your home directory. Makes it difficult to integrate with a modern build system.

It has so much momentum, and so many users, but man, there has to be a massive opening for someone to replace ffmpeg with a modern programming language and a modern build system, built with GPU acceleration of stuff in mind from the beginning and not tacked on top 20 years later, and not using 30 year old c-style code, and an actually documented project.

Heres a few lines out of the 700 line shell script; ${FFMPEG_CMD} -y -i $SIL -i ${STEP1_Q} -i $SIL -i ${STEP1_Q} -i $SIL -i ${STEP1_Q} -i $SIL -i ${ATTN_Q} -i $SIL -i ${ALERT_Q} -i ${STEP2BOUT} -i $SIL -i ${EOM_Q} -i $SIL -i ${EOM_Q} -i $SIL -i ${EOM_Q} -i $LOW -i $LOW -filter_complex concat=n=19:v=0:a=1 ${STEP2OUT} 2>> ${LOG_FILE} ... ${FFMPEG_CMD} -y -i ${STEP3OUT} -vf drawtext="fontfile=${FONT_FILE}:textfile=${INCOMING_DIR}/${VIDEO_LANG}.txt:fontcolor=white:fontsize=36:y=h-h/3:x=w-120*t" -b:v 9000k -maxrate 9000k -minrate 9000k -bufsize 1890k -acodec copy ${STEP4OUT} 2>> ${LOG_FILE} ...${FFMPEG_CMD} -i ${STEP2OUT} -f lavfi -i color=c=red:s=640x480:d="${TOTAL_CRAWLTIME}" -vf "subtitles=${SUBTITLES_FILE}:force_style='Alignment=10,Outline=0,Fontsize=18', subtitles=${SLIDE_NUMBERS_FILE}:force_style='Alignment=2,Outline=0', drawtext=fontfile=${FONT_FILE}:fontsize=30:fontcolor=white:y=line_h:x=(w-text_w)/2:text='MESSAGE D’FOO ou foo', drawtext=fontfile=${FONT_FILE}:fontsize=20:fontcolor=white:y=(h-80):x=(w-text_w)/2:text='English message to follow.'" -b:v 9000k -maxrate 9000k -minrate 9000k -bufsize 1890k -acodec libmp3lame ${STEP4OUT} 2>> ${LOG_FILE} ${FFMPEG_CMD} -y -i ${STEP5OUT} -vcodec libx264 -x264opts keyint=60:min-keyint=30:ref=3:bframes=0 -profile:v Main -level 3.1 -s 576:432 -g 60 -r 29.970 -crf 22 -maxrate:v 300k -bufsize 600k -acodec aac -ab 32k -ar 22050 -ac 1 -vbsf h264_mp4toannexb ${OUTPUT_DIR}/${BASE_FILE_NAME}.ts 2>> ${LOG_FILE}