Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 31 to 38 of 38
Thread
-
Open the source in Avidemux. Set the output format (lower left) to mp4 muxer.
Use the A and B buttons at the bottom to mark off a short section, one or two minutes.
Save, and verify that the file plays back properly. This will be the reference file for untrunc.
Open untrunc and give it the reference file and the bad file, it will create a third, the "fixed" file. -
First, in post #23 I post the error message when I first open the MP4. Nobody has addressed it, so, I don't know if Avidemux can deal with the file or if I should click on "proceed". Also, nobody has addressed by Avidemux is recommended or required to create the reference file. So, I used this command to create a 2 minute reference file:
Code:ffmpeg out.mp4 -t 00:02:00.000 -c copy to reference.mp4"
Code:Assertion failed! Program: untrunc-gui.exe File: src/atom.cpp, Line 481 Expression: end - start = = new_length <Abort> <Retry> <Ignore>
Code:General Complete name : C:out_fixed.mp4 Format : MPEG-4 Format profile : Base Media Codec ID : isom (isom/iso2/avc1/mp41) File size : 4.66 GiB Duration : 2 h 52 min Overall bit rate : 3 877 kb/s Writing application : Lavf58.78.100 IsTruncated : Yes Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4 Format settings : CABAC / 4 Ref Frames Format settings, CABAC : Yes Format settings, Reference frames : 4 frames Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 2 h 52 min Bit rate : 6 402 kb/s Maximum bit rate : 20.1 Mb/s Width : 1 920 pixels Height : 1 080 pixels Display aspect ratio : 16:9 Frame rate mode : Variable Frame rate : 29.937 FPS Minimum frame rate : 5.994 FPS Maximum frame rate : 120.000 FPS Original frame rate : 29.970 (30000/1001) FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.103 Stream size : 7.70 GiB Codec configuration box : avcC Audio ID : 2 Format : AAC LC Format/Info : Advanced Audio Codec Low Complexity Codec ID : mp4a-40-2 Duration : 2 h 51 min Bit rate mode : Constant Bit rate : 93.6 kb/s Channel(s) : 2 channels Channel layout : L R Sampling rate : 44.1 kHz Frame rate : 43.066 FPS (1024 SPF) Compression mode : Lossy Stream size : 118 MiB (2%) Default : Yes Alternate group : 1 Text #1 ID : 1-CC1 Format : EIA-608 Muxing mode : SCTE 128 / DTVCC Transport Muxing mode, more info : Muxed in Video #1 Duration : 2 h 52 min Bit rate mode : Constant Stream size : 0.00 Byte (0%) CaptionServiceName : CC1 Text #2 ID : 1-CC3 Format : EIA-608 Muxing mode : SCTE 128 / DTVCC Transport Muxing mode, more info : Muxed in Video #1 Duration : 2 h 52 min Bit rate mode : Constant Stream size : 0.00 Byte (0%) CaptionServiceName : CC3
- "skip unknown (-s)"
- "stretch video to match audio (-sv)"
- "keep unknown sequences (-k)"
Code:General Complete name : C:out.mp4_fixed-s1-k-sv.mp4 Format : MPEG-4 Format profile : Base Media Codec ID : isom (isom/iso2/avc1/mp41) File size : 7.82 GiB Duration : 2 h 52 min Overall bit rate : 6 507 kb/s Writing application : Lavf58.78.100 Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4 Format settings : CABAC / 4 Ref Frames Format settings, CABAC : Yes Format settings, Reference frames : 4 frames Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 2 h 52 min Bit rate : 6 402 kb/s Maximum bit rate : 20.1 Mb/s Width : 1 920 pixels Height : 1 080 pixels Display aspect ratio : 16:9 Frame rate mode : Variable Frame rate : 29.937 FPS Minimum frame rate : 5.994 FPS Maximum frame rate : 120.000 FPS Original frame rate : 29.970 (30000/1001) FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.103 Stream size : 7.70 GiB (98%) Codec configuration box : avcC Audio ID : 2 Format : AAC LC Format/Info : Advanced Audio Codec Low Complexity Codec ID : mp4a-40-2 Duration : 2 h 51 min Bit rate mode : Constant Bit rate : 93.6 kb/s Channel(s) : 2 channels Channel layout : L R Sampling rate : 44.1 kHz Frame rate : 43.066 FPS (1024 SPF) Compression mode : Lossy Stream size : 118 MiB (1%) Default : Yes Alternate group : 1 Text #1 ID : 1-CC1 Format : EIA-608 Muxing mode : SCTE 128 / DTVCC Transport Muxing mode, more info : Muxed in Video #1 Duration : 2 h 52 min Bit rate mode : Constant Stream size : 0.00 Byte (0%) CaptionServiceName : CC1 Text #2 ID : 1-CC3 Format : EIA-608 Muxing mode : SCTE 128 / DTVCC Transport Muxing mode, more info : Muxed in Video #1 Duration : 2 h 52 min Bit rate mode : Constant Stream size : 0.00 Byte (0%) CaptionServiceName : CC3
-
-
OK, it looks like I have a solution. After running untrunc, I end up with an MP4 where the video (via info from MediaInfo) is 2:51:54 long (the original length) and the audio is 2:52:05 long. A quick look in VLC seems to indicate that the 11 second difference on syncing the audio and video is evenly spread out. Doing a bit a math, the video is 0.998915331556 times as long as the audio. So, I decided to try the following command:
Code:ffmpeg" -i out_of_sync.mp4 -filter_complex "[0:v]setpts=1.0*PTS[v];[0:a]atempo=0.998915331556[a]" -map "[v]" -map "[a]" -crf 16 out_fix.mp4
I will post a final post for the thread that recaps the thread and solution for any future readers. -
**************************************
This is a recap of the thread issue and the solution
**************************************
I have an H264 MP4 that I downloaded from a streaming site via the Firefox add-on "Video DownloadHelper". Windows and VLC tells me that it is 2:51:54 long. At the 1:57:07 mark, the video track speeds up and then stops before the end, but, the audio track continues at normal speed to the end. VLC shows the frame rate to be 94.126760 (yeah, that's weird!). I downloaded that file at least 5 times and the problem starts at the same timestamp each time. When I stream the video in Firefox, everything works fine all of the way through to the end.
It was suggested that I use untrunc to correct the problem - an app that I have never used before. It needs a "reference file" that has all of the attributes/setting that you want for the resulting corrected file. It was suggested that I use Avidemux (another app I have never used) to create this reference file, but, instead I used this ffmpeg command to create a 2 minute long file from the beginning of the MP4:Code:ffmpeg out.mp4 -t 00:02:00.000 -c copy to reference.mp4"
- "skip unknown (-s)"
- "stretch video to match audio (-sv)"
- "keep unknown sequences (-k)"
Code:ffmpeg" -i out_of_sync.mp4 -filter_complex "[0:v]setpts=1.0*PTS[v];[0:a]atempo=0.998915331556[a]" -map "[v]" -map "[a]" -crf 16 out_new.mp4
The end result is that I was able to fix the MP4. But, I did not learn what might have caused this problem, what app to use to discover where/how/why the problem occurred, or, how it was fixed (meaning, I know that untrunc fixed it but I don't know what it changed/fixed). Simply, I just wanted to know exactly what was broken, but, I guess sometimes it is not worth knowing (for instance: "just reboot the computer to fix that") when you have a tool that can fix it. -
Most of the times I have encountered this is when I have inadvertantly joined 2 segments with different formats, particularly the AUDIO. Joining these videos gives different lengths for audio and video. Other mismatches cause similar problems but almost all that I have encounteredd have been from joining 2 segments of un-similar formats.
Joining 44.1k sample rate with 48k sample rate with ffmpeg delivers the following mediainfo.
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.1
Format settings : CABAC / 3 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 3 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 15 min 54 s
Source duration : 15 min 54 s
Bit rate : 792 kb/s
Width : 854 pixels
Height : 480 pixels
Audio
ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 17 min 18 s
Bit rate mode : Constant
Bit rate : 101 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 44.1 kHz
Frame rate : 43.066 FPS (1024 SPF)
Compression mode : Lossy
Similar Threads
-
How do I synchronize audio with video in an MP4 file?
By ilyaz in forum Video ConversionReplies: 3Last Post: 31st Mar 2022, 07:13 -
how do i replace part of mp4 file
By cns00 in forum EditingReplies: 7Last Post: 2nd Jan 2021, 10:05 -
How to Remove Some Middle Part From Video .mp4 File
By Daringbaaz in forum Newbie / General discussionsReplies: 2Last Post: 12th Feb 2019, 07:02 -
ToolNix / Avidemux merging mp4, 2nd part grey video correct audio
By jfjfjf in forum EditingReplies: 5Last Post: 18th Nov 2017, 16:56 -
MP4Box: How to extract a given part of a mp4 video
By semantics in forum Newbie / General discussionsReplies: 1Last Post: 9th Jan 2017, 18:38