Sunday, August 24, 2014

Convert FLV to MP4 or MKV without any loss


Steps:
1. Demux the FLV using FLV Extract
   http://www.moitah.net/ or https://code.google.com/p/flv-extraxct/
   FLVExtractCL -v -a INPUT.flv

2. Remux the video.264 and audio.aac to MP4 or MKV
   MP4Box -add videoFile.h264 -add audioFile.aac OUTPUT.mp4
   mkvmerge -o OUTPUT.mkv videoFile.264 audioFile.aac
   ffmpeg -i INPUT.flv -vcodec copy -acodec copy OUTPUT.mp4

Remember you need to set the correct framerate when muxing h264 video.
You can load the mp4 from ffmpeg directly into mkvmerge but I had a few issues so I just demux and then mux into mkv 
and I don't have any problems
 

Use MP4Box to extract raw streams from mp4 files
MP4Box -raw 1 -raw 2 INPUT.mp4
MP4Box -raw 1:output=filename INPUT.mp4
MP4Box -raw * INPUT.mp4

for users who dont like to code or type, a simple GUI for lossless packaging of RAW audio data (or RAW video data) is yamb.
I even prefer that to fixing FLV's with FLV Fix tools.

For example, when you (losslessly) extract *.264 and *.aac with FLVExtract and you then try to package them as *.mp4 with yamb,
then use the "Avg Frame Rate" (and not the "True Frame Rate") displayed by FLVExtract. yamb sometimes ask you to enter "frame
rate", sometimes it doesn't.

If the MP4 is still out of sync (audio vs. video), then use as "frame rate" the "videoframerate" as seen by "FLV Fix" (Replay
Media Catcher 4) after you have fixed the FLV with "Fix Duration".

No comments:

Post a Comment