VideoHelp Forum
+ Reply to Thread
Results 1 to 4 of 4
Thread
  1. I want to mux an .h264 and raw aac files to mp4 format. I tried following command with ffmpeg but it's not successful.
    Code:
    ffmpeg -i "track1.h264" -i "track2.aac" -vcodec copy -acodec copy "res.mp4"
    it threw an error
    Code:
    [mp4 @ 035A7440] malformated aac bitstream, use -absf aac_adtstoasc
    av_interleaved_write_frame(): Operation not permitted
    then I tried again with -absf aac_adtstoasc added
    Code:
    ffmpeg -i "track1.h264" -i "track2.aac" -vcodec copy -acodec copy -absf aac_adtstoasc "res.mp4"
    it muxed successfully but the result mp4 can not be played smoothly, it seem like playing with low frame rate.

    any suggestions?
    Quote Quote  
  2. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Maybe you can try set the framerate with "-r 24" (24fps).

    Or use mp4box, it's also a command line utility:
    Code:
    mp4box -add track1.h264:fps=24 -add track2.aac#audio -new res.mp4
    Quote Quote  
  3. 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.
    Quote Quote  
  4. Member
    Join Date
    Sep 2012
    Location
    Dominican Republic
    Search PM
    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_aacenc
    Last edited by rubiohiguey; 24th Aug 2013 at 11:55.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!