View Single Post
Old 21st January 2016, 23:32   #1  |  Link
MikeBell
Registered User
 
Join Date: Jan 2004
Posts: 7
How to change the framerate of an MP4 file without re-encoding video?

Hi all,

I have a poorly encoded video of a webcast (I presume it came from a WebEx screencast) and the main issue is that the framerate of the mp4 file is double than it should be. If I play it with VLC and slow down the playback speed to 0.5x, everything's normal and I can understand the audio. If I play it at 1x, I can't understand anything and everything's too fast.

Mediainfo says this about the file:

Code:
General
Complete name                            : source.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom
File size                                : 181 MiB
Duration                                 : 33mn 53s
Overall bit rate mode                    : Constant
Overall bit rate                         : 748 Kbps
Writing application                      : Lavf56.19.100

Video
ID                                       : 1
Format                                   : MPEG-4 Visual
Format profile                           : Simple@L1
Format settings, BVOP                    : No
Format settings, QPel                    : No
Format settings, GMC                     : No warppoints
Format settings, Matrix                  : Default (H.263)
Codec ID                                 : 20
Duration                                 : 33mn 53s
Bit rate mode                            : Constant
Bit rate                                 : 674 Kbps
Width                                    : 640 pixels
Height                                   : 480 pixels
Display aspect ratio                     : 4:3
Frame rate mode                          : Variable
Frame rate                               : 10.000 fps
Minimum frame rate                       : 9.990 fps
Maximum frame rate                       : 29.970 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.220
Stream size                              : 163 MiB (90%)
Writing library                          : Lavc52.108.0

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : 40
Duration                                 : 33mn 53s
Duration_LastFrame                       : -19ms
Bit rate mode                            : Constant
Bit rate                                 : 70.2 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Stream size                              : 17.0 MiB (9%)
My first stab at this problem was to use mp4box to change the framerate to 5fps. I actually succeeded at "slowing" down the video but I failed at slowing down the audio. Here's what I tried:

Code:
$ mp4box -add source.mp4\#video -raw 1 -new video
this created "video_track1.cmp" file.

Code:
$ mp4box -add source.mp4\#audio -raw 2 -new audio
this created "audio_track2.aac" file.

I then tried combining them with:

Code:
$ mp4box -add video_track1.cmp:fps=5 -add audio_track2.aac:fps=5 -new dest.mp4
This actually partially worked and produced a dest.mp4 that had video portion correct and it played at the right speed but the audio was still playing too fast:

Code:
 General
Complete name                            : dest.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom
File size                                : 181 MiB
Duration                                 : 1h 7mn
Overall bit rate mode                    : Variable
Overall bit rate                         : 373 Kbps
Encoded date                             : UTC 2016-01-21 22:24:30
Tagged date                              : UTC 2016-01-21 22:24:30

Video
ID                                       : 1
Format                                   : MPEG-4 Visual
Format profile                           : Simple@L1
Format settings, BVOP                    : No
Format settings, QPel                    : No
Format settings, GMC                     : No warppoints
Format settings, Matrix                  : Default (H.263)
Codec ID                                 : 20
Duration                                 : 1h 7mn
Bit rate mode                            : Variable
Bit rate                                 : 337 Kbps
Maximum bit rate                         : 929 Kbps
Width                                    : 640 pixels
Height                                   : 480 pixels
Display aspect ratio                     : 4:3
Frame rate mode                          : Constant
Frame rate                               : 5.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.220
Stream size                              : 163 MiB (90%)
Title                                    : cmp:fps=5@GPAC0.5.1-DEV-rev5375
Writing library                          : Lavc52.108.0
Encoded date                             : UTC 2016-01-21 22:24:30
Tagged date                              : UTC 2016-01-21 22:24:55

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : 40
Duration                                 : 33mn 53s
Bit rate mode                            : Variable
Bit rate                                 : 70.2 Kbps
Maximum bit rate                         : 87.8 Kbps
Channel(s)                               : 2 channels
Channel(s)_Original                      : 3 channels
Channel positions                        : Front: L C R
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Stream size                              : 17.0 MiB (9%)
Title                                    : aac:fps=5@GPAC0.5.1-DEV-rev5375
Encoded date                             : UTC 2016-01-21 22:24:52
Tagged date                              : UTC 2016-01-21 22:24:55
You can see above that Audio track's duration is wrong.

How do I fix the audio track? I don't mind re-encoding it with ffmpeg if that's the only option. I don't know how to do it however. Also, can mp4box do this on its own? What am I doing wrong?
MikeBell is offline   Reply With Quote