[MEncoder-users] amateur hour: reencoding a Canon Powershot movie

Guillaume POIRIER poirierg at gmail.com
Mon May 15 09:48:08 CEST 2006


Hi,

On 5/15/06, Charles Ulrich <charles at bityard.net> wrote:
> Greetings,
>
> This is my first foray into encoding. I have a Canon Powershot and
> occasionally record a few movies with it, but the files that it
> produces are huge. It saves them as a series of JPEG images (mjpeg)
> with uncompressed PCM audio. Record more than a few seconds worth and
> you end up with a file in the dozens of megabytes range. After hours
> of googling and tinkering, I've almost found the best combination of
> command-line options for transcoding these files. "Almost" meaning
> "seems to be transcoded the way I want it, _except_ the audio is out
> of sync (delayed) by about a half a second."

Please make sure you read these sections of the encoding guide:
http://www.mplayerhq.hu/DOCS/HTML/en/mencoder.html
http://www.mplayerhq.hu/DOCS/HTML/en/encoding-guide.html



> Here's the output of midentify on the file, for reference:
> ID_VIDEO_ID=0
> ID_AUDIO_ID=1
> ID_CLIP_INFO_NAME0=Digitization\ Time
> ID_CLIP_INFO_VALUE0=Sun\ Apr\ 23\ 11:51:02\ 2006
> ID_CLIP_INFO_NAME1=Software
> ID_CLIP_INFO_VALUE1=CanonMVI01
> ID_CLIP_INFO_N=2
> ID_FILENAME=LN2pool.avi
> ID_DEMUXER=avi
> ID_VIDEO_FORMAT=MJPG
> ID_VIDEO_BITRATE=1739672
> ID_VIDEO_WIDTH=320
> ID_VIDEO_HEIGHT=240
> ID_VIDEO_FPS=15.000
> ID_VIDEO_ASPECT=0.0000
> ID_AUDIO_CODEC=pcm
> ID_AUDIO_FORMAT=1
> ID_AUDIO_BITRATE=88192
> ID_AUDIO_RATE=11024
> ID_AUDIO_NCH=1
> ID_LENGTH=95.00
> ID_VIDEO_CODEC=ffmjpeg
>
> The command line that I'm using is as follows (in two passes, "vpass"
> is 1 on the first and 2 on the second, of course):
>
> mencoder LN2pool.avi -o LN2pool_small.avi -oac mp3lame -ovc lavc
> -srate 11025 -channels 1 -af-adv force=1 -lameopts preset=medium
> -lavcopts vcodec=mpeg4:vbitrate=496:vpass=1

I wouldn't suggest using lame during the encoding. I'd do smth similar to this:

mencoder LN2pool.avi -o LN2pool_small.avi -oac copy -ovc lavc -srate
11025 -channels 1 -af-adv force=1 -lavcopts
vcodec=mpeg4:vbitrate=496:vpass=1 -vf harddup

mencoder LN2pool.avi -o LN2pool_small.avi -oac copy -ovc lavc -srate
11025 -channels 1 -af-adv force=1 -lavcopts
vcodec=mpeg4:mbd=2:trell:vbitrate=496:vpass=2 -vf harddup

then extract the audio as pcm, encode it with lame, and remux with:

mencoder LN2pool_small.avi -audiofile audio.mp3 -oac copy -ovc copy -o
LN2pool_small-remuxed.avi


> Now for the questions:
>
> 1) When encoding, I get many messages about "Skipping frame(s)!" Is
> this good/bad/normal?

It's okay to have a few at the beginning, but not more than, say, 3 to 7.


> 2) After the file is finished encoding, the following output is produced:
>
> Video stream:  253.441 kbit/s  (31680 B/s)  size: 2914567 bytes
> 92.000 secs  1425 frames
>
> Audio stream:   26.998 kbit/s  (3374 B/s)  size: 312252 bytes  92.526 secs
>
> Notice that the audio stream is about 0.5 seconds longer than the
> video stream. I'm assuming that this is the main cause of the problem,
> but I've no idea how to overcome it. Suggestions?

The skipped frame probably cause the audio to "look" longer. It is
also possible that lame cause the desync as IIRC it does too much
buffering


> 3) The ID_AUDIO_RATE reported by midentify is 11024 whilst mencoder
> fails with the error "Cannot set LAME options, check
> bitrate/samplerate" if I set that on the commandline. Increment by one
> and everything works fine. Could the 1Hz difference be causing the
> problem? FWIW, encoded videos seem to be 0.5 seconds out of sync no
> matter what the length of the video is.

Nope, don't think so.

Guillaume
-- 
I am disillusioned enough to know that no man's opinion on any subject
is worth a damn unless backed up with enough genuine information to
make him really know what he's talking about.

-- H. P. Lovecraft (about the flamewars on FFmpeg and MPlayer-dev mailing lists)
http://www.brainyquote.com/quotes/quotes/h/hplovecr278144.html




More information about the MEncoder-users mailing list