LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-23-2008, 06:15 AM   #1
brokenpromises
Member
 
Registered: Jan 2005
Location: NZ
Distribution: Fedora / Debian
Posts: 99

Rep: Reputation: 21
Problems with mencoder


I'm using a script (hwdVideoShare - an addon for joomla. I've also tried clipshare out, and had the same problem as described below) and .avis etc transcode to flv just fine, but I've found there are certain 'problem formats' (wmvs and mp4s - there might be more but I haven't had time to test). These refuse to transcocde properly. Frames get dropped, resulting in audio/video sync errors etc. Here is the command hwdVideoShare it supposed to run:

Code:
$cmd_mencoder = "$mencoderpath $path_original -o $path_new -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=800:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -vf scale=450:400 -srate 22050";
But that errors out like so:

Code:
$ mencoder test.wmv -o test.flv -of lavf -oac mp3lame -lameopts abr:br=56
 vcodec=flv:vbitrate=800:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -vf scale=450:400 -srate 22050
MEncoder 1.0rc2-4.1.2 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Core(TM)2 Quad CPU           @ 2.40GHz (Family: 6, Model: 15, Stepping: 7)
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2

Option lavfopts: Unknown suboption i_certify_that_my_video_stream_does_not_use_b_frames
Error parsing option on the command line: -lavfopts

Exiting... (error parsing command line)
So to fix, I have to remove

Code:
-lavfopts i_certify_that_my_video_stream_does_not_use_b_frames
from the conversion command. That leaves me with this:

Code:
mencoder test.wmv -o test.flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=800:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -vf scale=450:400 -srate 22050
I ran this command in order to convert the test file and to write the output into a file:

Code:
mencoder test.wmv -o test.flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=800:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -vf scale=450:400 -srate 22050 > output
Here is what is in 'output' after the conversion is complete:

Code:
MEncoder 1.0rc2-4.1.2 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Core(TM)2 Quad CPU           @ 2.40GHz (Family: 6, Model: 15, Stepping: 7)
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2

success: format: 0  data: 0x0 - 0xd836e
ASF file format detected.
[asfheader] Audio stream found, -aid 1
[asfheader] Video stream found, -vid 2
VIDEO:  [WMV3]  640x480  24bpp  1000.000 fps  768.0 kbps (93.7 kbyte/s)
[V] filefmt:6  fourcc:0x33564D57  size:640x480  fps:1000.00  ftime:=0.0010
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, s16le, 96.0 kbit/6.81% (ratio: 12005->176400)
Selected audio codec: [ffwmav2] afm: ffmpeg (DivX audio v2 (FFmpeg))
==========================================================================
OK, exit
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [scale w=450 h=400]
==========================================================================
Opening video decoder: [dmo] DMO video codecs
Creating new registry
Failed to open registry file '/var/www/.mplayer/registry' for writing.
DMO dll supports VO Optimizations 0 1
DMO dll might use previous sample when requested
Failed to open registry file '/var/www/.mplayer/registry' for writing.
Failed to open registry file '/var/www/.mplayer/registry' for writing.
Failed to open registry file '/var/www/.mplayer/registry' for writing.
GetOutput r=0x0   size:921600  align:1
StreamCount r=0x0  1  1
Decoder supports the following formats: YV12 YUY2 UYVY YVYU RGB8 RGB555 RGB565 RGB24 RGB32
Decoder is capable of YUV output (flags 0x1b)
VDec: vo config request - 640 x 480 (preferred colorspace: Packed YUY2)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
videocodec: libavcodec (450x400 fourcc=31564c46 [FLV1])
[VE_LAVC] High quality encoding selected (non-realtime)!
Selected video codec: [wmv9dmo] vfm: dmo (Windows Media Video 9 DMO)
==========================================================================
MP3 audio selected.
VIDEO CODEC ID: 22
AUDIO CODEC ID: 15001, TAG: 0
Writing header...
I'm also getting a lot of

Code:
31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

65 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

65 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

32 duplicate frame(s)!

32 duplicate frame(s)!

34 duplicate frame(s)!

32 duplicate frame(s)!

32 duplicate frame(s)!

33 duplicate frame(s)!

36 duplicate frame(s)!

31 duplicate frame(s)!

31 duplicate frame(s)!

66 duplicate frame(s)!

34 duplicate frame(s)!

39 duplicate frame(s)!

36 duplicate frame(s)!

35 duplicate frame(s)!

36 duplicate frame(s)!

36 duplicate frame(s)!

35 duplicate frame(s)!

36 duplicate frame(s)!

36 duplicate frame(s)!

35 duplicate frame(s)!

36 duplicate frame(s)!

34 duplicate frame(s)!

35 duplicate frame(s)!

35 duplicate frame(s)!

35 duplicate frame(s)!
skipped frame errors. So many in fact, that i can't even scroll back up far enough.

Note the skipped frames. This causes huge issues with audio/video sync.

HOW TO FIX THESE SKIPPED FRAMES! I suspect getting "i_certify_that_my_video_stream_does_not_use_b_frames" is the key, but so far I've been unsuccessful. I'm pulling my hair out and have been for some time.

ANY help appreciated. I'm desperate.
 
Old 02-23-2008, 03:57 PM   #2
ComputerGreek
Member
 
Registered: Sep 2007
Posts: 152

Rep: Reputation: 30
Try explicitly stating the out frame rate -ofps and see what happens.
 
Old 02-23-2008, 05:17 PM   #3
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
Shouldn't it be -lavcopts? May just be a typo.
 
Old 02-23-2008, 08:48 PM   #4
brokenpromises
Member
 
Registered: Jan 2005
Location: NZ
Distribution: Fedora / Debian
Posts: 99

Original Poster
Rep: Reputation: 21
Lightbulb

I have somewhat fixed the problem, after finding out that downgrading to "MPlayer 1.0rc1-4.1.2" is a fix for this, after some EXTENSIVE googling.

I use this command now:

Code:
mencoder test.wmv -o test.flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=800:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -vf scale=450:400 -srate 22050
and it produces the following output:

Code:
MEncoder 1.0rc1-4.1.2 (C) 2000-2006 MPlayer Team
CPU: Intel(R) Core(TM)2 Quad CPU           @ 2.40GHz (Family: 6, Model: 15, Stepping: 7)
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2

success: format: 0  data: 0x0 - 0xd836e
ASF file format detected.
VIDEO:  [WMV3]  640x480  24bpp  30.000 fps    0.0 kbps ( 0.0 kbyte/s)
[V] filefmt:6  fourcc:0x33564D57  size:640x480  fps:30.00  ftime:=0.0333
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, s16le, 96.0 kbit/6.81% (ratio: 12005->176400)
Selected audio codec: [ffwmav2] afm: ffmpeg (DivX audio v2 (FFmpeg))
==========================================================================
** MUXER_LAVF *****************************************************************
You have certified that your video stream does not contain B frames.
REMEMBER: MEncoder's libavformat muxing is presently broken and will generate
INCORRECT files in the presence of B frames. Moreover, due to bugs MPlayer
will play these INCORRECT files as if nothing were wrong!
*******************************************************************************
OK, exit
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [scale w=450 h=400]
==========================================================================
Opening video decoder: [dmo] DMO video codecs
DMO dll supports VO Optimizations 0 1
DMO dll might use previous sample when requested
GetOutput r=0x0   size:921600  align:1
StreamCount r=0x0  1  1
Decoder supports the following formats: YV12 YUY2 UYVY YVYU RGB8 RGB555 RGB565 RGB24 RGB32
Decoder is capable of YUV output (flags 0x1b)
VDec: vo config request - 640 x 480 (preferred colorspace: Packed YUY2)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
SwScaler: reducing / aligning filtersize 7 -> 8
SwScaler: reducing / aligning filtersize 7 -> 8
SwScaler: reducing / aligning filtersize 6 -> 5
SwScaler: reducing / aligning filtersize 6 -> 5

SwScaler: BICUBIC scaler, from yuv420p to yuv420p using MMX2
SwScaler: using 8-tap MMX scaler for horizontal luminance scaling
SwScaler: using 8-tap MMX scaler for horizontal chrominance scaling
SwScaler: using n-tap MMX scaler for vertical scaling (YV12 like)
SwScaler: 640x480 -> 450x400
videocodec: libavcodec (450x400 fourcc=766c66 [flv])
[VE_LAVC] High quality encoding selected (non-realtime)!
Selected video codec: [wmv9dmo] vfm: dmo (Windows Media Video 9 DMO)
==========================================================================
MP3 audio selected.
New_Face failed. Maybe the font path is wrong.
Please supply the text font file (~/.mplayer/subfont.ttf).
subtitle font: load_sub_face failed.
VIDEO CODEC ID: 0
AUDIO CODEC ID: 15001, TAG: 0
Writing header...
Pos:   0.7s     22f (25%)  0.00fps Trem:   0min   0mb  A-V:0.070 [0:45]
Skipping frame!
Pos:   1.1s     34f (32%) 28.48fps Trem:   0min   0mb  A-V:0.069 [1298:46]
Skipping frame!
Pos:   1.9s     58f (44%) 34.52fps Trem:   0min   0mb  A-V:0.067 [1328:47]
Skipping frame!
Pos:   2.3s     73f (53%) 36.92fps Trem:   0min   0mb  A-V:0.006 [1358:47]]
1 duplicate frame(s)!
Pos:   4.2s    129f (77%) 43.63fps Trem:   0min   0mb  A-V:0.012 [1231:47]]
1 duplicate frame(s)!
Pos:   5.0s    152f (88%) 43.08fps Trem:   0min   0mb  A-V:0.019 [1151:47]
1 duplicate frame(s)!
Pos:   5.6s    169f (97%) 42.13fps Trem:   0min   0mb  A-V:0.023 [1118:47]
1 duplicate frame(s)!
Pos:   6.2s    184f (100%) 41.12fps Trem:   0min   0mb  A-V:-0.024 [1079:47]
1 duplicate frame(s)!
Pos:   6.2s    185f (100%) 40.96fps Trem:   0min   0mb  A-V:-0.026 [1083:47]
Flushing video frames
Writing index...
SEEK 4
SEEK 52
SEEK 174
SEEK 887461

Video stream: 1083.010 kbit/s  (135376 B/s)  size: 843845 bytes  6.233 secs  185 frames

Audio stream:   47.674 kbit/s  (5959 B/s)  size: 36738 bytes  6.165 secs
Still a few 'flushed' frames, there's still some audio/video sync issue, but its nowhere near as bad as it used to be.

I'm guessing there is no 100% fix to this?

Also - If I hard-wire -ofps 24 into the script, what happens when it comes across a video that isn't 24 fps? Which is more than likely seeing users are going to be uploading their own videos.

Last edited by brokenpromises; 02-23-2008 at 08:50 PM.
 
Old 02-23-2008, 10:40 PM   #5
ComputerGreek
Member
 
Registered: Sep 2007
Posts: 152

Rep: Reputation: 30
Quote:
Originally Posted by brokenpromises View Post
Also - If I hard-wire -ofps 24 into the script, what happens when it comes across a video that isn't 24 fps? Which is more than likely seeing users are going to be uploading their own videos.
Your script can grab the framerate from the video header.

Your file looks a bit weird:

MEncoder 1.0rc2-4.1.2 (C) 2000-2007 MPlayer Team
VIDEO: [WMV3] 640x480 24bpp 1000.000 fps 768.0 kbps (93.7 kbyte/s)

MEncoder 1.0rc1-4.1.2 (C) 2000-2006 MPlayer Team
VIDEO: [WMV3] 640x480 24bpp 30.000 fps 0.0 kbps ( 0.0 kbyte/s)

0.0 kbps?
 
Old 02-23-2008, 11:39 PM   #6
brokenpromises
Member
 
Registered: Jan 2005
Location: NZ
Distribution: Fedora / Debian
Posts: 99

Original Poster
Rep: Reputation: 21
Oh I see, reason it look weird is because I was trying out different builds at the time. Initially I had no success, but "MEncoder 1.0rc1-4.1.2 (C) 2000-2006 MPlayer Team" (an older build) works as it takes the

Code:
-lavfopts i_certify_that_my_video_stream_does_not_use_b_frames
arguments without erroring out.

How can I get the frame rate from the header? I have very little scripting experience

Last edited by brokenpromises; 02-24-2008 at 07:55 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
problems with mencoder for video compatibility with Sansa e250 zach014 Linux - Software 5 07-31-2007 09:54 AM
Using mencoder masand Linux - Software 10 05-27-2007 01:12 PM
Problems encoding DVDs with MEncoder. adz Linux - Software 5 10-26-2003 12:39 AM
MEncoder audio codec problems ddpicard Linux - Software 16 05-29-2003 03:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration