[MEncoder-users] Encoding iPhone MOV into MPEG-2 -- Video framerate is super fast!?

Jarred Nicholls jarred.nicholls at gmail.com
Wed Nov 11 09:35:56 CET 2009


For any who are interested, it appears quite stable and reliable to mux any
a/v streams into an AVI container using ffmpeg first (vcodec and acodec set
to copy), and then let mencoder deal with an AVI container using "-mc 0", at
least when going to DVD formatted MPEG-2 and AC-3.  Consistently I'm only
loosing about 100ms - 500ms of video off the end, but the a/v are synced
perfectly every time.  I tested sources in h.264, h.263, m-jpeg, and wmv.

On Wed, Nov 11, 2009 at 12:11 AM, Jarred Nicholls <jarred.nicholls at gmail.com
> wrote:

> Just to append to my last message: the a/v is a little out of sync because
> the resulting video is about a full second shorter in length from the audio.
>  I noticed skipped frames at the beginning of the encoding process.  I'll
> try forcing "-noskip" and worse case i'll just stick with the AVI mux
> workaround.
>
> Thanks,
> Jarred
>
>
> On Wed, Nov 11, 2009 at 12:06 AM, Jarred Nicholls <
> jarred.nicholls at gmail.com> wrote:
>
>> Wow that actually is working!  I used -mc 0 and figured since that didn't
>> work there was no hope.  LIterally -mc 0.1 is the only thing changed and now
>> all of a sudden it's fine.  How does that help the situation when mencoder
>> (and ffmpeg actually) doesn't correctly identify the source's variable
>> framerate?
>>
>> So yeah, after using -mc 0.1, it is no longer showing the same problems as
>> before...however, the audio is slightly behind the video.  Between 500ms and
>> 1sec I'd say.  I did something funky as a workaround, but not sure if it
>> will be a universal workaround.  It did work surprisingly well however:  I
>> used ffmpeg to copy the MOV's audio and video and mux it into an AVI
>> container verbatim.  I then used the same exactly mencoder command with "-mc
>> 0" added to it, and the resulting MPEG-2 was spot on.  I'd prefer to make
>> mencoder work in one shot, so is there anything else I can do to help the
>> a/v sync after adding "-mc 0.1"?  Maybe -nobps?
>>
>> I'm not cropping but I do need to scale to bring the "rotated" height down
>> to 480 to fit onto a 720x480 stage.  That is NTSC DVD compliance and my
>> optimal output.
>>
>> Thanks a lot for your help Laine,
>> Jarred
>>
>> On Tue, Nov 10, 2009 at 11:35 PM, L Lee <llee040 at sbcglobal.net> wrote:
>>
>>> On 11/10/09 9:13 PM, "Jarred Nicholls" <jarred.nicholls at gmail.com>
>>> wrote:
>>>
>>> > Hi everyone,
>>> >
>>> > Firstly I appreciate you all taking the time to help with this issue.
>>>  Maybe
>>> > it will stand out as an obvious or simple solution to someone.
>>> >
>>> > I am encoding a video taken from an iPhone 3GS (h.264 video, MOV
>>> container
>>> > at 90 degree rotation/transformation matrix in the tkhd header). I have
>>> had
>>> > troubles encoding this type of video into DVD compliant MPEG-2 video
>>> using
>>> > mencoder (no issues with ffmpeg), but for this type of video I need
>>> mencoder
>>> > strictly for the expand and rotate filters.  The resulting MPEG-2 video
>>> is
>>> > super fast (every 2 out of 5 frames are dropped/skipped when encoding)
>>> and
>>> > the audio after muxed with the video is at its original speed.  It's
>>> almost
>>> > like the frame rate is super fast (~50+ fps), but definitely has
>>> something
>>> > to do with the frames being dropped.  MediaInfo reports the average fps
>>> is
>>> > 19 (the video is variable fps).
>>> >
>>> > Here is the command I run:
>>> >
>>> > mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd:tsaf -vf
>>> > rotate=1,expand=720:480,harddup -srate 44100 -af lavcresample=44100
>>> > -lavcopts
>>> >
>>> vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:v
>>> > strict=0:acodec=ac3:abitrate=192:aspect=4/3
>>> > -ofps 30000/1001 -o test2.mpg IMG_0018.MOV
>>> >
>>> > Here is a link to the source video and the result video respectively:
>>> >
>>> > http://www.bcam.org/tmp/IMG_0018.MOV
>>> > http://www.bcam.org/tmp/test2.mpg
>>> >
>>> > I have tried several alterations to the command above.  One in
>>> particular
>>> > was to simply remove the explicit -ofps setting to see if it would
>>> simply
>>> > keep the original video's framerate...and it errored out saying
>>> "MPEG1/2
>>> > does not support 617/12 fps" which is approximately 51.41fps.  This
>>> would
>>> > explain the skipped frames and the video speed up, but why is it
>>> reading
>>> > 51.41fps when the original video is (on average) only 19fps?
>>> >
>>>
>>> What happens if you add -mc 0.1 to the end of your command line?
>>> Don't you want to crop vertically to preserve aspect ratio? Try
>>> "crop=480:540:0:32" right after your "rotate" filter.
>>>
>>> Laine Lee
>>>
>>>
>>> _______________________________________________
>>> MEncoder-users mailing list
>>> MEncoder-users at mplayerhq.hu
>>> https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
>>>
>>
>>
>


More information about the MEncoder-users mailing list