View Page Source

Revision (current)
Last Updated by adelikat on 8/19/2022 1:57 AM
Back to Page


!! Introduction
If you've come this far, all of the grunt work is out of the way - now you just need to put together the separate video and audio tracks into one final package and show it to the world (or at least the TASVideos community).

!! Muxing
This step differs slightly depending on if you are using the DeDup plugin for AVISynth or not.
%%TAB MKV (most cases)%%
Assuming your video track is {{video.mp4}} and your audio track is {{audio.ogg}}, you will need to use one of the following two command lines to mux together your audio and video.

If you are encoding for a console intended to be displayed on a TV, you will need to specify a 4:3 aspect ratio thus:
 mkvmerge --aspect-ratio 1:4/3 video.mp4 audio.ogg -o encode.mkv

If you are encoding for a handheld console, this is not necessary:
 mkvmerge video.mp4 audio.ogg -o encode.mkv

If your encode is meant to be uploaded to streaming video site with time limit, add {{--split duration:hh:mm:ss.sss}}, where actual time limit is set, to your command.

If all goes well, after running the command and a brief delay you will have your final {{encode.mkv}}.  Congratulations!

%%TAB MKV (AVISynth DeDup)%%
You will need to instruct {{mkvmerge}} to use the {{times.txt}} file output from DeDup; this is done by adding {{--timecodes 1:times.txt}} to the command line __before the video track__ as follows:

(for TV consoles)
 mkvmerge --aspect-ratio 1:4/3 --timecodes 1:times.txt video.mp4 audio.ogg -o encode.mkv

(for handhelds)
 mkvmerge --timecodes 1:times.txt video.mp4 audio.ogg -o encode.mkv

%%TAB MP4 (most cases)%%
__Note:__ OGG Vorbis audio is effectively incompatible with the MP4 container; you should be using AAC audio if you are muxing to MP4.

__Note:__ If x264 output was to raw .264 file, add {{-fps 60}} (or whatever the fps is). Otherwise the final .mp4 will play at wrong speed.

Use the following command line to mux the two into an MP4:
 MP4Box -add video.mp4 -add audio.mp4 -new encode.mp4

If all goes well, after running the command and a brief delay you will have your final {{encode.mp4}}.  Congratulations!

%%TAB MP4 (AVISynth DeDup /w NHMLTransform)%%
You will need a copy of [user:Aktan]'s NHMLTransform program; grab it from

 MP4Box video.mp4 -nhml 1
 MP4Box audio.mp4 -nhml 1
 NHMLTransform.bat -i video_track1.nhml -t times.txt -o video2.nhml -ia audio_track1.nhml -oa audio2.nhml
 MP4Box -add video2.nhml -add audio2.nhml -new encode.mp4

%%TAB MP4 (AVISynth DeDup /w NHMLFixup)%%
You will need a copy of [user:Ilari]'s NHMLFixup program; grab it from [Forum/Posts/246798] (the Lua executable it requires can be obtained from (windows), distribution package repositories (Linux) or compiled from source (Unix) ).

Assume you have saved the audio track as __{{audio.mp4}}__, video track as __{{video.mp4}}__, timecode file as __{{times.txt}}__, the NHMLFixup script as {{NHMLFixup.lua}}[1], and your Lua binary is {{lua}}[2], Then run (assuming non-handheld game):

 MP4Box -nhml 1 video.mp4
 MP4Box -nhml 1 audio.mp4
 lua NHMLFixup.lua video_track1.nhml audio_track1.nhml times.txt tvaspect
 MP4Box -add video_track1.nhml -add audio_track1.nhml -new encode.mp4

If this is handheld (GBx, GG, DS, etc..) game, replace the NHMLFixup command with

 lua NHMLFixup.lua video_track1.nhml audio_track1.nhml timecodes.txt

That is, leave out the __{{tvaspect}}__ option (since aspect ratio correction is not wanted in that case).

This saves the resulting encode as __{{encode.mp4}}__.

__Note:__ The audio track ID may not be 1! If you convert raw .aac file to .mp4 using some versions of MP4Box, the resulting track ID will be 101, not 1!


!! Uploading
Prior to uploading, you should rename your encode according to the [Publisher Guidelines].  This usually takes the form of {{<gamename>-tas<version>-<branch>-<author>.{mkv|mp4} }} with {{<version>}} or {{<branch>}} being omitted as necessary.

Although all published encodes are mirrored on [|], we prefer that you only upload a movie there if you know that it is going to be the encode that is published (i.e. when the movie has been accepted and the publisher has informed you that your encode will be published).  Many of our encoders use [|MediaFire] for temporary hosting of encodes when the above conditions are not met, though you can use any other file hosting service at your discretion.

Once your encode has been uploaded, post a link in the discussion thread to your encode.  You're done!  Now everyone can enjoy the end result of your hard work.

Previous page: [EncodingGuide/Legacy/Encoding|Encoding]

[#1]: The default filename for the script is NHMLFixup-v<#>.lua, e.g. NHMLFixup-v10.lua; feel free to adjust the .bat to account for this.

[#2]: This may not be the case for Windows binaries; it may be, for example, {{lua5.1}}.