I want to mux an .h264 and raw aac files to mp4 format. I tried following command with ffmpeg but it's not successful.
it threw an errorCode:ffmpeg -i "track1.h264" -i "track2.aac" -vcodec copy -acodec copy "res.mp4"
then I tried again with -absf aac_adtstoasc addedCode:[mp4 @ 035A7440] malformated aac bitstream, use -absf aac_adtstoasc av_interleaved_write_frame(): Operation not permitted
it muxed successfully but the result mp4 can not be played smoothly, it seem like playing with low frame rate.Code:ffmpeg -i "track1.h264" -i "track2.aac" -vcodec copy -acodec copy -absf aac_adtstoasc "res.mp4"
any suggestions?
+ Reply to Thread
Results 1 to 4 of 4
-
-
according to MediaInfo, the result video res.mp4 still preserve frame rate, so i don't think frame rate is problem.
I want to preserve the frame rate as original, so i think it shouldn't specify frame rate parameter in command.
Now I tried mux mp4 from only h264 video with simple command:
ffmpeg -i "track1.h264" -vcodec copy "res.mp4"
but it said "[matroska @ 036C7800] Can't write packet with unknown timestamp"
I stick with ffmpeg and don't want to use any other multiplexer.Last edited by DKhanh; 18th Nov 2011 at 21:09.
-
Though this is an old thread, somebody might find this answer useful:
from: http://superuser.com/questions/133413/joining-h264-without-re-encoding
And this YES works for ME 100% (just make sure files you are merging have same resolution, frame, rate)
ffmpeg -i File1.mp4 -c copy -bsf h264_mp4toannexb File1.ts
ffmpeg -i File2.mp4 -c copy -bsf h264_mp4toannexb File2.ts
ffmpeg -i "concat:File1.ts|File2.ts" -c copy -bsf aac_adtstoasc FinalFile.mp4
This will merge MOST H264/MP4 files (with same specs) without any issues.
Sometimes there is problem that the audio does not mux properly in that case use:
(Also, sometime when joing 2 TS files and converting them into MP4 you might find some video issues like frame drop or fast forward effect, this is caused by bad audio sync, so just use this second version with audio reencode to take care of the issue)
ffmpeg -i File1.mp4 -c copy -bsf h264_mp4toannexb File1.ts
ffmpeg -i File2.mp4 -c copy -bsf h264_mp4toannexb File2.ts
ffmpeg -i "concat:File1.ts|File2.ts" -vcodec copy -aprofile aac_low -acodec aac -strict experimental -cutoff 15000 -vbsf aac_adtstoasc FinalFile.mp4
(This second version will copy video but will reencode audio and will take care of audio issues. )
the last line you can also use
ffmpeg -i "concat:File1.ts|File2.ts" -vcodec copy -aprofile aac_low -acodec libvo_aacenc -vbsf aac_adtstoasc FinalFile.mp4 but I investigated that aac is superior to libvo_aacenc but you must specify certain otherparameters as indicated above in order to use aac instead of default libvo_aacencLast edited by rubiohiguey; 24th Aug 2013 at 11:55.
Similar Threads
-
CLI to mux/merge MP4 video and AAC audio?
By RogerTango in forum Video ConversionReplies: 8Last Post: 13th May 2013, 15:43 -
mux h264/aac flv into h264/aac mkv
By Pitorasilo in forum Newbie / General discussionsReplies: 4Last Post: 18th Jul 2011, 09:36 -
H264/AC3 (MKV) to H264/AAC (MP4) ?
By jccca in forum Video ConversionReplies: 10Last Post: 13th Dec 2008, 19:06 -
remux h264 and aac to mp4
By madmillington in forum Video ConversionReplies: 2Last Post: 6th Feb 2008, 14:18 -
h264/AAC mkv -> h264/AAC mp4?
By joshwa in forum Video ConversionReplies: 7Last Post: 4th Jan 2008, 11:08