Hey everyone,
Im almost at the point of giving in on this, I have spend roughly 18+hrs on trying to get this sorted but with no luck, so this is my last resort.
I have Multiple MP4 files that i am editing the audio track on, i have done 14 so far without issue, But this one is giving me nightmares,
This is the file info according to FFMPEG,
Code:[STREAM] index=0 codec_name=h264 codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 profile=High codec_type=video codec_time_base=1001/60000 codec_tag_string=avc1 codec_tag=0x31637661 width=1280 height=720 has_b_frames=1 sample_aspect_ratio=1:1 display_aspect_ratio=16:9 pix_fmt=yuv420p level=40 color_range=N/A color_space=unknown timecode=N/A id=N/A r_frame_rate=30000/1001 avg_frame_rate=848910000/28331303 time_base=1/90000 start_pts=1890 start_time=0.021000 duration_ts=934932999 duration=10388.144433 bit_rate=4278652 max_bit_rate=N/A bits_per_raw_sample=8 nb_frames=311267 nb_read_frames=N/A nb_read_packets=N/A DISPOSITION:default=1 DISPOSITION:dub=0 DISPOSITION:original=0 DISPOSITION:comment=0 DISPOSITION:lyrics=0 DISPOSITION:karaoke=0 DISPOSITION:forced=0 DISPOSITION:hearing_impaired=0 DISPOSITION:visual_impaired=0 DISPOSITION:clean_effects=0 DISPOSITION:attached_pic=0 TAG:language=und TAG:handler_name=VideoHandler [/STREAM] [STREAM] index=1 codec_name=aac codec_long_name=AAC (Advanced Audio Coding) profile=unknown codec_type=audio codec_time_base=1/48000 codec_tag_string=mp4a codec_tag=0x6134706d sample_fmt=fltp sample_rate=48000 channels=2 channel_layout=stereo bits_per_sample=0 id=N/A r_frame_rate=0/0 avg_frame_rate=0/0 time_base=1/48000 start_pts=0 start_time=0.000000 duration_ts=498631680 duration=10388.160000 bit_rate=93450 max_bit_rate=N/A bits_per_raw_sample=N/A nb_frames=486854 nb_read_frames=N/A nb_read_packets=N/A DISPOSITION:default=1 DISPOSITION:dub=0 DISPOSITION:original=0 DISPOSITION:comment=0 DISPOSITION:lyrics=0 DISPOSITION:karaoke=0 DISPOSITION:forced=0 DISPOSITION:hearing_impaired=0 DISPOSITION:visual_impaired=0 DISPOSITION:clean_effects=0 DISPOSITION:attached_pic=0 TAG:language=und TAG:handler_name=SoundHandler [/STREAM]
This is how i work with my files,
Import Original MP4 into Sony Vegas > Edit audio as needed > render as mp4 with only AAC audio track > demux original MP4 > Demux edited MP4 > Mux edited AAC and original H264 into output MP4.
That has worked flawlessly for hours of footage.
With this file i have tried demuxing and muxing with the following programs,
My MP4 Box GUI
MediaCoder
mp4muxer
DGAVCindex
However, the output file is always out of sync, Even if i demux the original MP4 and mux it.. it turns out exactly the same, its either in sync at the beginning of the video and out of sync at the end, or visa versa.
I have completely re-encoded the file using mediacoder and the output is out of sync... which makes no sense,
The original MP4 is Perfect, in terms of it plays fine, without any sync issues,
One thing i have noticed however is that when i check the demuxed audio, it says it is 1:27:02 mins, but will play until the original length of 2:53:08, Another thing is that Sony Vegas reports the frame rate as 29.964 when everything else reports it as 29.970 (same as all the other videos i have edited)
It feels as though i have tried everything i can find on google, but never had any luck,
I am trying to keep the original unedited H264 stream, purely because of quality and its never touched.
Any help would be fantastic,
Chris.
+ Reply to Thread
Results 1 to 8 of 8
-
-
Hi, thanks for the quick reply,
Just checked what VFR is and i feel dumb for not knowing that, When muxing with mp4muxer, i have tried the variable frame rate check box with no discernible difference in the output,
But this is the media info output.
Code:General Complete name : C:\Sin.2001.720p.mp4 Format : MPEG-4 Format profile : Base Media Codec ID : isom File size : 5.54 GiB Duration : 2h 53mn Overall bit rate mode : Variable Overall bit rate : 4 580 Kbps Tagged date : UTC 2015-03-06 01:52:34 Writing application : Lavf55.32.101 mp4creator 1.6.1d Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4.0 Format settings, CABAC : Yes Format settings, ReFrames : 3 frames Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 2h 53mn Bit rate mode : Variable Bit rate : 4 280 Kbps Maximum bit rate : 5 500 Kbps Width : 1 280 pixels Height : 720 pixels Display aspect ratio : 16:9 Frame rate mode : Variable Frame rate : 29.970 fps Minimum frame rate : 0.447 fps Maximum frame rate : 29.970 fps Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.155 Stream size : 5.17 GiB (93%) Audio #1 ID : 2 Format : AAC Format/Info : Advanced Audio Codec Format profile : LC Codec ID : 40 Duration : 2h 53mn Bit rate mode : Variable Bit rate : 93.5 Kbps Maximum bit rate : 304 Kbps Channel(s) : 2 channels Channel positions : Front: L R Sampling rate : 48.0 KHz Compression mode : Lossy Stream size : 116 MiB (2%) Audio #2 ID : 3 Format : AAC Format/Info : Advanced Audio Codec Format profile : LC Codec ID : 40 Duration : 2h 50mn Source duration : 2h 53mn Bit rate mode : Variable Bit rate : 196 Kbps Maximum bit rate : 199 Kbps Channel(s) : 2 channels Channel positions : Front: L R Sampling rate : 48.0 KHz Compression mode : Lossy Stream size : 239 MiB (4%) Source stream size : 243 MiB (4%) Language : English Encoded date : UTC 2015-03-06 01:52:32 Tagged date : UTC 2015-03-06 01:52:34 Text ID : 1-CC1 Format : EIA-608 Muxing mode : SCTE 128 / DTVCC Transport Muxing mode, more info : Muxed in Video #1 Duration : 2h 53mn Bit rate mode : Constant Stream size : 0.00 Byte (0%) Encoded stream size : 0.00 Byte (0%)
-
Frame rate mode : Variable
Frame rate : 29.970 fps
Minimum frame rate : 0.447 fps
Maximum frame rate : 29.970 fps
VFR = Variable Frame Rate
This means each frame isn't displayed for the same duration. ie. The FPS speeds up and slows down in sections. Timecodes control the display duration of frames. When you demux the video from the container, you lose those timecodes
It's not possible to edit VFR in traditional NLE's like vegas which use a CFR timeline, it must be converted to "approximately" CFR. The conversion isn't perfect, and it might go slightly in and out of sync, but not as bad as what you probably have now
If your goal is to keep the video as-is without re-encoding, you need to keep it VFR, but edit a "converted" CFR version of it in vegas. Then export the audio. It is possible to remux that version with timecodes and keep it VFR -
Hey, Thanks for your help on this,
I was just reading the media info output and noticed 2 audio tracks.. which there is only one in the original, but the file i got the output from was the original, then i realised i accidentally overwritten the original MP4 when i was muxing earlier, 1 is the edited audio track and the other is the original... So i played the MP4 and switched the audio channels, and noticed they were perfectly in sync, which makes sense now you have told me about VFR,
Is there a way to remove an audio track from an MP4 without muxing and loosing the VFR info? If i can do thats i will leave it as is and that will have to do. -
ffmpeg should be able to do it and copy the timecodes over with -map to specify the wanted streams. Double check the stream numbers are correct (the mediainfo stream numbering doesn't always correspond to ffmpeg stream numbering
Usually, 0:0 will be the 1st video, 0:1 will be 1st audio, 0:2 will be 2nd audio.
So if you wanted to keep the video and 2nd audio:
ffmpeg -i input.mp4 -map 0:0 -map 0:2 -c:v copy -c:a copy -movflags faststart output.mp4
To be clear, the input mp4 will remain (it won't be overwritten), but the video and audio #2 will be copied over into a new mp4 container with the timecodes
There are other utilies for deal with VFR streams as well, like mp4fpsmod -
-
Cheers
It is possible to do what you had planned, as described by using a "CFR" version of that video imported into vegas to use as visual cues. It won't be perfect - not suitable for something that requires perfect timing - but it will be close
The converted CFR version inserts frames approximately where were dropped in the first place (frames are usually dropped in VFR video) . So you do your audio manipulations in vegas as you normally would, using the CFR 29.97 version as a visual guide. Export audio as usual, then mux into the MP4 container with timecodes