Dealing with the audio and quickly creating a DVD using the IMM4,5 or 6 based AVI files.
The previous posts on the IMM4,5 or 6 Codec are regularly high up on the most viewed statistics. In order to further support you in dealing with these files I have been working alongside a colleague to find the easiest methods to complete certain tasks.
1. Extracting the Audio stream
2. Creating a Video DVD compliant file.
Although for most of the work we have to utilize Mencoder, as detailed in the original post, it is possible to extract the audio stream quickly using FFmpeg.
ffmpeg -i yourIMM4.avi -vn -c:a copy youraudiostream.wav
The resulting file will be a direct copy of the original audio with no transcoding. This could be suitable for further analysis or clarification within other software.
It is not possible to deal with the video with FFmpeg due to the IMM4 Codec so from now on, Mplayer and Mencoder will help us out.
The first stage is to extract the audio into an interim format and container that can be later transcoded to AC3 for the Video DVD. If your file doesn’t have audio – you can skip this bit!
mplayer -ao pcm:fast:file=audio.wav -vo null -vc null yourIMM4.avi
As a result we get a new Audio file, named here as audio.wav
Next we have to transcode the video part of the file into a DVD Compliant Format (PAL used in this example). This file retains the 704×576 size of the video but expands the image by adding 16 pixels of black to ensure DVD compatibility (720×576).
When using the original player, all images are exported at 640×480 suggesting that the correct Display Aspect Ratio is 4:3 (see original article). As such I have added a 4:3 display aspect ratio flag to my Video DVD output.
mencoder yourIMM4.avi -nosound -ovc lavc -of mpeg -mpegopts format=dvd:tsaf:vaspect=4/3 -vf scale=704:576,expand=720:576,harddup -lavcopts acodec=null:vcodec=mpeg2video:vrc_buf_size=1835: vrc_maxrate=6000:vbitrate=5000:mbd=2:trell:keyint=15:vstrict=0: aspect=4/3:ildct:ilme -ofps 25 -o yourIMM4_DVD.mpg
Note: The entire command above is on one line – It has been seperated here to assist in display
Lastly, we need to convert the separated audio wav file into an AC3 or MP2 audio stream and mux that together with the video.
I have found it easier and quicker to do this at the DVD authoring stage.
AVStoDVD has a preference to not encode DVD compliant video so it doesn’t transcode the video, only the audio. I have my audio transcoding set to AC3.
The resulting VOB file with Video and Audio:
It is very easy to save these commands in a text file and then the only thing you need to add is your input / output file. Within a matter of minutes you have a DVD compliant version of your original IMM based AVI file.
The following web pages may help you more in understanding the syntax of Mencoder
I had no sync problems with this 11 minute clip but it is possible that a longer duration may suffer with A/V Sync issues. As such this method may not be suitable and you may need to conduct this process by installing the codec. You will then be able to transcode within software that is able to pick up and utilize the IMM4 Codec.
The only way to be 100% confident on how this video should be played would be to go back to the site and conduct some analysis. I have used the 4:3 Aspect ratio used by the player when exporting images.
The Metadata contained within the AVI Container includes Date / Time information. This is then read and displayed within the player and is not read by this process. If that information is relevant, this process would not be suitable.
I hope that this has highlighted that being aware of all these issues can help you in certain circumstances….but not all.
If you want to grab the audio without being on a PC with the codec installed – you can.
If you want to quickly encode the footage to Video DVD – you can.
As always, these tools and commands are not the answers to all your prayers – just one or two!!
Pingback: IMM4 Codec and MEncoder | Spreadys.com
Pingback: IMM5 and IMM6 Codec | Spreadys.com
you get audio desync because you split the audio and video.
if you just convert imm4 to dvd directly with mencoder and dont mess with -fps or -ofps you should not get desync. examples for encoding audio and video to mpeg2/dvd are in the manual/docs of course.
i say ‘should’ because mencoder is getting old. maybe we should start a kickstarter to get binary codec loader into ffmpeg.
Thanks again to Compn for some valuable points and the idea of a codec loader for ffmpeg sounds a brilliant idea.
Hello I am so happy I found your web site, I really found you
by mistake, while I was looking on Digg for something else, Nonetheless I am
here now and would just like to say kudos
for a remarkable post and a all round interesting blog (I also love the theme/design), I don’t have time to read through it all at
the minute but I have bookmarked it and also added in your
RSS feeds, so when I have time I will be back to read a great deal more, Please do keep up the superb work.
Having read this I believed it was extremely informative.
I appreciate you taking the time and effort to put this
information together. I once again find myself personally spending a significant amount of time both reading and commenting.
But so what, it was still worth it!
Excellent. Thank you