Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > New and alternative a/v containers

Reply
 
Thread Tools Search this Thread Display Modes
Old 19th June 2012, 23:05   #1  |  Link
Dacicus
Registered User
 
Join Date: Jun 2012
Posts: 3
[SOLVED] A/V synch problems when trying to correct video from Android phone

Hello. I have an MP4 file that was recorded on a Nexus S 4G phone by a family member. The file plays back well on the device, but it is upside-down when copied to a PC via USB. I would like to rotate it so it displays properly on the PC.

Some online searching showed that MP4Box can extract the elementary streams from an MP4 file, so I used its -raw option to do so. This produced an .h264 and an .aac file. I ran the former through DGAVCIndex to produce a .dga file and then composed the following AviSynth file:
Code:
LoadPlugin("DGAVCDecode.dll")
LoadPlugin("BassAudio.dll")
AVCSource("VID_20120527_172827_track1.dga")
FlipVertical()
FlipHorizontal()
a = last
b = bassAudioSource("VID_20120527_172827_track2.aac")
AudioDub(a, b)
This fixed the upside-down video, but the audio and video were out of synch when previewed in VirtualDub, with the audio starting much too early. AviSynth's AssumeFPS function looked useful, and I calculated an FPS of 30.00865 (=7000/233.266) based on the following output of mp4box -info for the original MP4 file:
Code:
* Movie Info *
        Timescale 1000 - Duration 00:03:53.792
        Fragmented File no - 2 track(s)
        File Brand isom - version 0
        Created: GMT Fri Jul 03 07:00:38 2082

File has no MPEG4 IOD/OD

Track # 1 Info - TrackID 1 - TimeScale 90000 - Duration 00:03:53.266
Media Info: Language "Undetermined" - Type "vide:avc1" - 7000 samples
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 720 x 480 - Profile Baseline @ Level 3.1
NAL Unit length bits: 32
Self-synchronized

Track # 2 Info - TrackID 2 - TimeScale 16000 - Duration 00:03:53.792
Media Info: Language "Undetermined" - Type "soun:mp4a" - 3653 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio AAC LC - 1 Channel(s) - SampleRate 16000
Synchronized on stream 1
Adding AssumeFPS(30.00865) after FlipHorizontal() improves the synch, but now the audio is slightly too late, as is it with AssumeFPS(30).

I'd like any input about what I am doing wrong in this process. Thanks!

Last edited by Dacicus; 23rd June 2012 at 18:33. Reason: Problem solved
Dacicus is offline   Reply With Quote
Old 20th June 2012, 01:35   #2  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Don't use AssumeFPS() for a constant delay offset. Use DelayAudio().

If the desync increase as the file plays we have another issue. Does the desync remain constant?

What frame rate does DGAVCIndex report?

Last edited by Guest; 20th June 2012 at 01:38.
Guest is offline   Reply With Quote
Old 20th June 2012, 04:52   #3  |  Link
Dacicus
Registered User
 
Join Date: Jun 2012
Posts: 3
The desynch does increase as the file plays. DGAVCIndex says that the .h264 file has a frame rate of 25.000 fps.
Dacicus is offline   Reply With Quote
Old 20th June 2012, 05:06   #4  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
>The desynch does increase as the file plays.

OK, but with what AssumeFPS() value?

You have to find the original frame rate and then AssumeFPS() that, followed by fixing the offset with DelayAudio().

The frame rate of the MP4 is 30 fps (confirmed with web search). DGAVCIndex reports 25 because there is no VUI to specify the frame rate and so it defaults to 25 fps.

So, set AssumeFPS(30) and use DelayAudio() to fix the offset.

AVCSource("VID_20120527_172827_track1.dga")
AssumeFPS(30)
FlipVertical()
vid=FlipHorizontal()
aud=bassAudioSource("VID_20120527_172827_track2.aac").DelayAudio(???) # replace ??? with correct offset
AudioDub(vid,aud)

Last edited by Guest; 20th June 2012 at 05:12.
Guest is offline   Reply With Quote
Old 23rd June 2012, 18:30   #5  |  Link
Dacicus
Registered User
 
Join Date: Jun 2012
Posts: 3
Quote:
Originally Posted by neuron2 View Post
>The desynch does increase as the file plays.

OK, but with what AssumeFPS() value?
That was without any AssumeFPS() value specified.

Quote:
Originally Posted by neuron2 View Post
So, set AssumeFPS(30) and use DelayAudio() to fix the offset.
That worked! Thank you very much!
Dacicus is offline   Reply With Quote
Reply

Tags
android, audio, desynch, phone, video

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 14:14.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.