Philip Walden
2011-03-22 22:04:58 UTC
I am trying to use mencoder as as transcoder for a minidlna. Basically
mencoder get called to transcode the source video into mpeg2 DVD format.
This works great except for some mp4 files I download from PBS.org.
Other mp4/flv work fine. When I transcode these I get the "Too many
audio packets in the buffer" error and it stops. I understand that one
can encode the video and audio separately and then remux them in a
second step, but the transcoder has to do it in one step.
If use ffmpeg to transcode, I have no problems. However, ffmpeg seems to
be 2-3x slower on my system and I have trouble with some files that are
very HD or have lots of noise/artifacts causing the bitrate to spike.
If anyone can suggest a different set of prarmeters I would appreciate
the help. Here is the failing run. Dropping the harddup causes huge A/V
sync issues. I have a Intel i3 3 GHz and 2GB of memory, so I don't think
lack of machine resources is a problem.
$ mencoder -oac lavc -of mpeg -mpegopts
format=mpeg2:muxrate=25000:vbuf_size=1194:abuf_size=64 -vf
scale=720:480,harddup -ovc lavc -lavdopts debug=0 -lavcopts
autoaspect=1:vcodec=mpeg2video:vbitrate=8000:acodec=ac3:abitrate=128:keyint=18:vqscale=1:vqmin=2
-subdelay 20000 -ofps 30000/1001 -mc 0 -noskip -af lavcresample=48000
-srate 48000 -o test.mpg NOSN_CanWeMakeItToMars.mp4
MEncoder SVN-r31628-4.4.4 (C) 2000-2010 MPlayer Team
success: format: 0 data: 0x0 - 0x1135caeb
libavformat file format detected.
[flv @ 0x9ebcdd0] Estimating duration from bitrate, this may be inaccurate
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0
VIDEO: [H264] 512x288 0bpp 15.000 fps 0.0 kbps ( 0.0 kbyte/s)
[V] filefmt:44 fourcc:0x34363248 size:512x288 fps:15.000 ftime:=0.0667
==========================================================================
Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding)
FAAD: compressed input bitrate missing, assuming 128kbit/s!
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
Selected audio codec: [faad] afm: faad (FAAD AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
PACKET SIZE: 2048 bytes, deltascr: 17694
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [harddup]
Opening video filter: [scale w=720 h=480]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
[ac3 @ 0x9fecd50] No channel layout specified. The encoder will guess
the layout, but it might be incorrect.
Limiting audio preload to 0.4s.
Increasing audio density to 4.
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect..000 [0:0]
[swscaler @ 0xa06b0a0] BICUBIC scaler, from yuv420p to yuv420p using MMX2
videocodec: libavcodec (720x480 fourcc=3267706d [mpg2])
[VE_LAVC] Using constant qscale = 1.000000 (VBR).
Writing header...
INITV: 0.200, 0.167, fps: 29.970
Pos: 95.7s 2868f ( 6%) 154.90fps Trem: 4min 1082mb A-V:0.000
[5747:128]
Too many audio packets in the buffer: (4096 in 3776561 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
For AVI files, try to force non-interleaved mode with the -ni option.
Flushing video frames.
Writing index...
Overhead: 1.397% (940131 / 67305373)
Writing header...
Video stream: 5747.125 kbit/s (718390 B/s) size: 68722852 bytes
95.662 secs 2868 frames
Audio stream: 128.000 kbit/s (16000 B/s) size: 1537024 bytes 96.064 secs
[***@walden8 NovaScienceNow]$ mencoder -demuxer help
MEncoder SVN-r31628-4.4.4 (C) 2000-2010 MPlayer Team
No file given
Exiting... (error parsing command line)
mencoder get called to transcode the source video into mpeg2 DVD format.
This works great except for some mp4 files I download from PBS.org.
Other mp4/flv work fine. When I transcode these I get the "Too many
audio packets in the buffer" error and it stops. I understand that one
can encode the video and audio separately and then remux them in a
second step, but the transcoder has to do it in one step.
If use ffmpeg to transcode, I have no problems. However, ffmpeg seems to
be 2-3x slower on my system and I have trouble with some files that are
very HD or have lots of noise/artifacts causing the bitrate to spike.
If anyone can suggest a different set of prarmeters I would appreciate
the help. Here is the failing run. Dropping the harddup causes huge A/V
sync issues. I have a Intel i3 3 GHz and 2GB of memory, so I don't think
lack of machine resources is a problem.
$ mencoder -oac lavc -of mpeg -mpegopts
format=mpeg2:muxrate=25000:vbuf_size=1194:abuf_size=64 -vf
scale=720:480,harddup -ovc lavc -lavdopts debug=0 -lavcopts
autoaspect=1:vcodec=mpeg2video:vbitrate=8000:acodec=ac3:abitrate=128:keyint=18:vqscale=1:vqmin=2
-subdelay 20000 -ofps 30000/1001 -mc 0 -noskip -af lavcresample=48000
-srate 48000 -o test.mpg NOSN_CanWeMakeItToMars.mp4
MEncoder SVN-r31628-4.4.4 (C) 2000-2010 MPlayer Team
success: format: 0 data: 0x0 - 0x1135caeb
libavformat file format detected.
[flv @ 0x9ebcdd0] Estimating duration from bitrate, this may be inaccurate
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0
VIDEO: [H264] 512x288 0bpp 15.000 fps 0.0 kbps ( 0.0 kbyte/s)
[V] filefmt:44 fourcc:0x34363248 size:512x288 fps:15.000 ftime:=0.0667
==========================================================================
Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding)
FAAD: compressed input bitrate missing, assuming 128kbit/s!
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
Selected audio codec: [faad] afm: faad (FAAD AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
PACKET SIZE: 2048 bytes, deltascr: 17694
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [harddup]
Opening video filter: [scale w=720 h=480]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
[ac3 @ 0x9fecd50] No channel layout specified. The encoder will guess
the layout, but it might be incorrect.
Limiting audio preload to 0.4s.
Increasing audio density to 4.
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect..000 [0:0]
[swscaler @ 0xa06b0a0] BICUBIC scaler, from yuv420p to yuv420p using MMX2
videocodec: libavcodec (720x480 fourcc=3267706d [mpg2])
[VE_LAVC] Using constant qscale = 1.000000 (VBR).
Writing header...
INITV: 0.200, 0.167, fps: 29.970
Pos: 95.7s 2868f ( 6%) 154.90fps Trem: 4min 1082mb A-V:0.000
[5747:128]
Too many audio packets in the buffer: (4096 in 3776561 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
For AVI files, try to force non-interleaved mode with the -ni option.
Flushing video frames.
Writing index...
Overhead: 1.397% (940131 / 67305373)
Writing header...
Video stream: 5747.125 kbit/s (718390 B/s) size: 68722852 bytes
95.662 secs 2868 frames
Audio stream: 128.000 kbit/s (16000 B/s) size: 1537024 bytes 96.064 secs
[***@walden8 NovaScienceNow]$ mencoder -demuxer help
MEncoder SVN-r31628-4.4.4 (C) 2000-2010 MPlayer Team
No file given
Exiting... (error parsing command line)
--
Linuxfest Northwest - Apr 30-May 1, 2011
<http://www.linuxfestnorthwest.org/>
Linuxfest Northwest - Apr 30-May 1, 2011
<http://www.linuxfestnorthwest.org/>