Post subject: Encoding settings (ffmpeg)
Editor, Emulator Coder, Site Developer
Joined: 5/11/2011
Posts: 1108
Location: Murka
This sounds like a silly place to ask this, but I think you guys are rather knowledgeable about these sorts of things. I am working on a modification to a doom source port for direct video capture. My motivation was to get something with the same capabilities that the emulators used here have: non-realtime frame-exact capture, with sound perfectly synced to video. I didn't want to use anything platform specific (eg AVI output like visualboy advance), nor did I want to use anything that adds additional dependencies at build time (linking in something like libavcodec directly). My solution is to use popen() to spawn encoding processes. The power user is then free to plug in any encoder he wants to that can read raw video or raw audio from stdin. I'd like however for the not-so-skilled user (especially under Windows) to be able to automatically dump videos that are of reasonable file size and quality while being uploadable to places like youtube directly. So I can bundle a free encoder with the download, set default command lines, and it all works presto gizmo. Here are the default invocations in the current beta version:
#audio pipe: stdin is 16bit signed stereo audio at samplerate %s
"ffmpeg -f s16le -ar %s -ac 2 -i pipe:0 -acodec libvorbis -f ogg -aq 5 output.ogg"
#video pipe: stdin is 24bit rgb raw video at size %w x %h, 35fps
"ffmpeg -f rawvideo -pix_fmt rgb24 -s %wx%h -r 35 -i pipe:0 -vcodec libx264 -f mp4 -fpre ./libx264-baseline.ffpreset -crf 22 output.mp4"
#mux command: run after recording is complete.  %f was specified by user on commandline
"ffmpeg -i output.ogg -i output.mp4 -vcodec copy -acodec copy %f"
When %f is somefile.mkv, this has the problem that the output mkv is somehow damaged; it doesn't play right, but remux it with mkvmerge and it plays perfectly. There are no other output containers that ffmpeg will put both avc and vorbis into (I thought you could put avc into ogg, but apparently not). I could use avc+aac in mp4, but ffmpeg's aac encoder is marked experimental. I could bring in extra dependencies (like mkvmerge); but I'd like to keep the distribution size down; static link ffmpeg.exe is already 11MB. So I guess my question is; can anyone recommend default encoding settings for a one-pass automated situation like this. If ffmpeg absolutely isn't up to the job, I am willing to consider replacements. Remember that doom footage (especially with glitz like 32 bit color, hires, opengl, texture filtering, and hires texture replacements) is not going to compress well under ZMBV or anything similar.
Site Admin, Skilled player (1255)
Joined: 4/17/2010
Posts: 11495
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Isn't doom9 forum a better place for such speciffic stuff?
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Publisher
Joined: 4/23/2009
Posts: 1283
I was going to suggest doing what archive does in their automated process, but I saw they just copy the already made AAC file we send to Archive, lol. Maybe test out the experimental AAC in FFMPEG, though YouTube doesn't like MP4 much anyway. The best solution would probably just include mkvmerge. I don't see any other way right now. Edit: Also if it is meant to be uploaded to YouTube, remember to turn off header compression, or else the video may end up gray. More details here: http://tasvideos.org/forum/viewtopic.php?t=10628