Monday, 24 January 2011

H.264 FLV to MP4 without Re-Encoding


I have had an issue recently where I would like to produce MP4 files for my corresponding FLV files, preferably a batch process (as I have a fair few) without re-encoding. After all, I knew my FLV files were all H.264 and the FLV was only the container; so I didn't see why I needed to re-encode the whole batch and potentially lose further quality.

This is when I stumbled upon FLV Extract. This is an amazing tool, downloadable source as well, written in C#. This allows me to extract the video and audio streams for a FLV file. This will produce corresponding .264 and .ACC/.MP3 files. Excellent!

With these files, I now needed a way to generate my MP4 file. This is where MP4Box became quite handy. It will produce a nice MP4 container for .264 and .AAC files, even more amazing!

I now needed a way to batch this up. I opened up Notepad and drafted a quick batch script. This will search the current directory for all .FLV files, ensure the .264 and .aac/.mp3 files have been produced, run them through MP4Box, and drop the MP4's into a complete directory. It will then clean up the temporary files afterwards.
It works pretty well, I have added some brief instruction, and you can download the full package here.

For a 100mb video, it can take around ~5-10seconds on an average system.

H.264 FLV to MP4 (Without Re-encoding) Download Here

6 comments:

Anonymous said...

Thanks a lot !

Anonymous said...

That's great!
Cheers mate!

Anonymous said...

Awesome!!, saved me days

Anonymous said...

I was searching for a software to do this job for a long time. And finally your solution is so quick and easy. Thank you.

┼×ahin K said...

nice script but video / audio sync problem here

Anonymous said...

thanks, very helpfull!