Thread: Faulty avi's to mp4 help
hi,
firstly, appologies length , detail in post, thought best provide detail possible.
background
have several hundred video files sourced pal dvd's. have been encoded h264 , put avi containers original ac3 soundtrack. can't remember precise command, used ffmpeg acheive this. these have been played on xbmc , in capacity there have been no major issues. myself , other family members have several ios devices capable of playing type of content, if transfer them mp4 containers aac audio playback on devices , still have them avaiable play on xbmc.
my aim
i'm trying create simple script achieve this. without going detail of script, basic function follows:
1) mux avi mkv using mkvmerge
2) demux mkv elemental streams using mkvextract (steps 1&2 seem necessary because can't step 3 work extracting elemental streams other way)
3) hack h264 stream appears level 4.1
4) encode ac3 stream aac using ffmpeg
5) mux h264, aac, , ac3 streams mp4 using mp4 box.
the problems!
works correctly , working mp4 file @ end. resulting file does, have audio sync issues. interstingly if ffmpeg -i on original avi, shows frame rate 29.97, not 25 should it's sourced pal dvd. xbmc plays video @ 25fps , audio pretty stays in sync.
now, if force mp4box mux @ 25fps audio starts in sync, drifts out , end of movie, there 1 sec diff.
interestingly if mp4box -info on finished file, get:
you'll notice there on 1 second's difference between duration of audio , video. seems why audio getting out of sync. seems duration of video calculated using total number of frames (which given in mp4box -info) , dividing fps.code:* movie info * timescale 600 - duration 01:51:49.086 fragmented file no - 3 track(s) file brand m4v - version 0 created: gmt sun jun 19 09:28:39 2011 file has root iod scene pl 0xff - graphics pl 0xff - od pl 0xff visual pl: avc/h264 profile (0x15) audio pl: aac profile @ level 2 (0x29) no streams included in root od itunes info: name: me, myself , irene genre: adventure created: 2000 cover art: jpeg file track # 1 info - trackid 1 - timescale 25000 - duration 01:51:48.000 media info: language "undetermined" - type "vide:avc1" - 167700 samples mpeg-4 config: visual stream - objecttypeindication 0x21 avc/h264 video - visual size 704 x 544 - profile high @ level 4.1 nal unit length bits: 32 pixel aspect ratio 11133:34464 - indicated track size 704 x 544 self-synchronized track # 2 info - trackid 2 - timescale 48000 - duration 01:51:49.034 media info: language "undetermined" - type "soun:mp4a" - 314486 samples mpeg-4 config: audio stream - objecttypeindication 0x40 mpeg-4 audio aac lc - 2 channel(s) - samplerate 48000 synchronized on stream 1 track # 3 info - trackid 3 - timescale 48000 - duration 01:51:49.088 media info: language "undetermined" - type "soun:ac-3" - 209659 samples ac3 stream - sample rate 48000 - 2 channel(s) 16 bits per samples
1 possible solution have considered, trying determine total number of frames before muxing mp4, calculate fps based on , duration of audio. in case above fps 24.99. use when muxing mp4.
seem valid solution , work? if so, there way determine total number of frames @ earlier stage in process(avi, mkv, or elemental) can used in script?
or, there better solution?
help,
phil
handbrake should accept .avi format input, happily make .mp4 files & gives great deal of control on output.
i've been using handbrakecli sometime & find absolutely brilliant tool ripping/transcoding.
hope can solve problem.
http://handbrake.fr/details.php
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support Multimedia Software [SOLVED] Faulty avi's to mp4 help
Ubuntu
Comments
Post a Comment