tags:

views:

3413

answers:

3

Ive been smashing my head with this for a while. I have 2 completely identical .wmv files encoded with wmv3 codec. I put them both through ffmpeg with the following command:

/usr/bin/ffmpeg -i file.wmv -ar 44100 -ab 64k -qscale 9 -s 512x384 -f flv file.flv

One file converts just fine, and gives me the following output:

 FFmpeg version SVN-r11070, Copyright (c) 2000-2007 Fabrice Bellard, et al.
  configuration: --prefix=/usr --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --extra-cflags=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic --enable-liba52 --enable-libfaac --enable-libfaad --enable-libgsm --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libxvid --enable-libx264 --enable-pp --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-optimizations --disable-strip
  libavutil version: 49.5.0
  libavcodec version: 51.48.0
  libavformat version: 51.19.0
  built on Jun 25 2008 09:17:38, gcc: 4.1.2 20070925 (Red Hat 4.1.2-33)
Seems stream 1 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 29.97 (30000/1001)
Input #0, asf, from 'ok.wmv':
  Duration: 00:14:22.3, start: 3.000000, bitrate: 467 kb/s
    Stream #0.0: Audio: wmav2, 44100 Hz, stereo, 64 kb/s
    Stream #0.1: Video: wmv3, yuv420p, 320x240 [PAR 0:1 DAR 0:1], 400 kb/s, 29.97 tb(r)
Output #0, flv, to 'ok.flv':
    Stream #0.0: Video: flv, yuv420p, 512x384 [PAR 0:1 DAR 0:1], q=2-31, 200 kb/s, 29.97 tb(c)
    Stream #0.1: Audio: libmp3lame, 44100 Hz, stereo, 64 kb/s
Stream mapping:
  Stream #0.1 -> #0.0
  Stream #0.0 -> #0.1
Press [q] to stop encoding
frame=25846 fps=132 q=9.0 Lsize=   88486kB time=862.4 bitrate= 840.5kbits/s
video:80827kB audio:6738kB global headers:0kB muxing overhead 1.050642%

While another file, fails:

FFmpeg version SVN-r11070, Copyright (c) 2000-2007 Fabrice Bellard, et al.
  configuration: --prefix=/usr --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --extra-cflags=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic --enable-liba52 --enable-libfaac --enable-libfaad --enable-libgsm --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libxvid --enable-libx264 --enable-pp --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-optimizations --disable-strip
  libavutil version: 49.5.0
  libavcodec version: 51.48.0
  libavformat version: 51.19.0
  built on Jun 25 2008 09:17:38, gcc: 4.1.2 20070925 (Red Hat 4.1.2-33)
[wmv3 @ 0x3700940d20]Extra data: 8 bits left, value: 0

Seems stream 1 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 25.00 (25/1)
Input #0, asf, from 'bad3.wmv':
  Duration: 00:06:34.9, start: 4.000000, bitrate: 1666 kb/s
    Stream #0.0: Audio: 0x0162, 48000 Hz, stereo, 256 kb/s
    Stream #0.1: Video: wmv3, yuv420p, 512x384 [PAR 0:1 DAR 0:1], 1395 kb/s, 25.00 tb(r)
File 'ok.flv' already exists. Overwrite ? [y/N] y
Output #0, flv, to 'ok.flv':
    Stream #0.0: Video: flv, yuv420p, 512x384 [PAR 0:1 DAR 0:1], q=2-31, 200 kb/s, 25.00 tb(c)
    Stream #0.1: Audio: libmp3lame, 48000 Hz, stereo, 64 kb/s
Stream mapping:
  Stream #0.1 -> #0.0
  Stream #0.0 -> #0.1
Unsupported codec (id=0) for input stream #0.0

The only difference I see is with the Input audio codec

Working:

Stream #0.0: Audio: wmav2, 44100 Hz, stereo, 64 kb/s

Not working:

 Stream #0.0: Audio: 0x0162, 48000 Hz, stereo, 64 kb/s

Any ideas?

+2  A: 

Well the obvious answer is that the audio is encoded differently in the second wmv file, so they are not completely identical. You could try forcing it to use a specific audio codec for the 'bad' wmv, and see if that works. Perhaps it's just having trouble picking the right codec? However it seems more likely that the 'bad' wmv has some sort of audio codec that's not supported by ffmpeg.

Also try the usual stuff, make sure you've upgraded to the latest version, check out any development versions that may contain bugfixes etc.

davr
A: 

Or, alternatively, use mencoder

Milan Babuškov
+3  A: 

It is in fact the audio format, which causes trouble. Audio formats are identified by its TwoCC (0x0162 here). You can look up the different TwoCCs here: http://wiki.multimedia.cx/index.php?title=TwoCC and you'll find:

0x0162 Windows Media Audio Professional V9

This codec isn't supported yet by ffmpeg and mencoder as far as I know. You can search at google for "ffmpeg audio 0x0162" and check for yourself.

razong