MEncoder

„MEncoder is a free command line video decoding, encoding and filtering tool released under the GNU General Public License. It is a close sibling to MPlayer and can convert all the formats that MPlayer understands into a variety of compressed and uncompressed formats using different codecs.“

MEncoder. (2008, February 23). In Wikipedia, The Free Encyclopedia. Retrieved 18:57, April 5, 2008, from
http://en.wikipedia.org/w/index.php?title=MEncoder&oldid=193447614


My Blog List

Friday, May 9, 2008

[MEncoder-users] Sync and Encoding audio: AAC and muxing

Up until recently, I've used mencoder to encode and mux MPEG-2.

Now I've begun trying to encode h.264 with AAC in AVI and then remux
with mp4box.

There are a couple of reasons behind my not wanting to mux with lavf in
mencoder:
- all of the reasons outlined on this list and in the docs (including b
frames problem)
- to be able to remux for bluray (because, as I understand it, I'd have
to remux anyway)

I'm fine with the whole process except for audio encoding. I think
there is something fundamental that I don't understand about encoding
audio or the way that audio is muxed into a stream.

I've hit a road block in understanding how AAC is encoded and how it is
synced in a stream.

In all of my tests, I can't seem to get AAC audio to match the exact
length of the video it is paired with.

Here is an example:


** Note that all of my attempts are based on uncompressed avi files or
wav files and/or raw audio/video coming from a Framesserver.


I've got a video source with 305 frames with audio that lasts exactly
305 frames at 24 fps = 12.7083333 seconds.

For instance, when I encode using the following command line:

mencoder -vf harddup -ovc x264 -x264encopts bitrate=8000 -oac faac
-faacopts
mpeg=4:object=2:br=224 -channels 2 -srate 48000 -ofps 24 export.avs -o
h264.avi

I get an h.264 encoded video track with 304 frames (12.667s )(because
one frame is skipped) and an audio track that is (12.651s). Why the
discrepency in length??? This is 16 ms difference.

If I add -mc 0 to the command line, I get back the original 305 frames
of video (12.708s), but the audio is still (12.651s). This is a 57 ms
difference.

Obviously mencoder compensated for the difference in the first example
and tried to keep the sync close, but shouldn't I be able to get back
the full 305 frames of video along with the full 12.708s of audio?

So I did a lot more testing of the audio track. I grabbed the WAV file
and encoded it with command line encoders to AAC using ffmpeg, faac,
neroaac. In the case of ffmpeg I tried encoding to mp3 as well. In all
cases, with no video to worry about, the duration of the encoded audio
was always different from the duration of the WAV audio.

Why is this?

I want to be able to get back the original full length of the video and
audio so I don't have to worry about sync issues. Is this possible and
under what circumstances?? Would I still have to worry about sync
issues if my audio length and video length were the same??

Someone please point me in the right direction. Thanks!

_______________________________________________
MEncoder-users mailing list
MEncoder-users@mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users

No comments:

PCBs

Links

Forex brokers, Forex online


Privacy Policy