Dacicus
19th June 2012, 23:05
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:
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:
* 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!
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:
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:
* 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!