2
votes

I'm having a few problems converting video files from the command line using FFMPEG. I'm using a CentOS server, but unfortunately I don't have shell access.

When I suppress sound using the following command, everything works perfectly (except of course, there's no sound!)

ffmpeg -i $infile -an test.flv

However, when I try to enable sound in any way at all, the file being outputted has a file size of zero kb.

FFMPEG is compiled with support for libmp3lame and libfaac, and the necessary codecs are installed. Here is the configuration of FFMPEG on the server:

FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2007 Fabrice Bellard, et al. configuration: --prefix=/usr --libdir=/usr/lib --mandir=/usr/share/man --incdir=/usr/include/ffmpeg --enable-libmp3lame --enable-libogg --enable-libvorbis --enable-libogg --enable-libtheora --enable-libfaad --enable-libfaac --enable-libgsm --enable-xvid --enable-x264 --enable-liba52 --enable-liba52bin --enable-pp --enable-shared --enable-pthreads --enable-gpl --disable-strip

Here is a very small sample of some of the commands I've tried that result in a 0Kb file size:

ffmpeg -i $infile test.flv
ffmpeg -i $infile -vcodec copy -acodec ac3 test.flv
ffmpeg -vcodec copy -acodec copy -i $infile -vcodec copy -acodec mp3 test.flv
ffmpeg -vcodec copy -acodec copy -i $infile -vcodec copy -acodec copy $outfile
ffmpeg -vcodec copy -acodec copy -i $infile -vcodec copy -acodec aac $outfile

If anyone could provide any hints on what's going on here, I'd really appreciate it!

EDIT - here is the result when I redirect stderr to a file

FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2007 Fabrice Bellard, et al. configuration: --prefix=/usr --libdir=/usr/lib --mandir=/usr/share/man --incdir=/usr/include/ffmpeg --enable-libmp3lame --enable-libogg --enable-libvorbis --enable-libogg --enable-libtheora --enable-libfaad --enable-libfaac --enable-libgsm --enable-xvid --enable-x264 --enable-liba52 --enable-liba52bin --enable-pp --enable-shared --enable-pthreads --enable-gpl --disable-strip libavutil version: 49.4.0 libavcodec version: 51.40.4 libavformat version: 51.12.1 built on Jun 4 2007 11:02:12, gcc: 4.1.1 20070105 (Red Hat 4.1.1-52)

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/path/to/7b4e37e703ce0a104f027cb9125b1a19.mp4': Duration: 00:00:32.4, start: 0.000000, bitrate: 122 kb/s Stream #0.0(jpn): Video: h263, yuv420p, 176x144, 29.97 fps(r) Stream #0.1(jpn): Audio: samr / 0x726D6173, 8000 Hz, mono

Output #0, flv, to '/path/to/test.flv': Stream #0.0: Video: flv, yuv420p, 176x144, q=2-31, 200 kb/s, 29.97 fps(c) Stream #0.1: Audio: mp3, 8000 Hz, mono, 64 kb/s Stream mapping: Stream #0.0 -> #0.0 Stream #0.1 -> #0.1

Unsupported codec (id=73728) for input stream #0.1

2

2 Answers

4
votes

What sort of access do you have to the server - you must have some ability to run commands on it.

That being the case, what is the error output from ffmpeg?

Possibly an appropriate verbose argument would tell you more about the problem?

EDIT:

Let's see if we can get stderr output. Run:

ffmpeg -version 

And see if you can get some output for it. Once you've managed to extract some stderr output then we can investigate the original issue.

EDIT:

So it looks like you're loosing stderr - now you need to work out how to retrieve it.

Maybe:

ffmpeg -version 2>&1

will work?

EDIT:

How we're getting somewhere - the input audio codec isn't supported:

Unsupported codec (id=73728) for input stream #0.1

I don't know what Stream #0.1(jpn): Audio: samr / 0x726D6173, 8000 Hz, mono is.

But there's you're problem.

I suggest that you might want to investigate on a local Linux box - it might be easier to see problems.

EDIT:

From http://www.nabble.com/Convert-3gp-samr-file-td20514476.html it looks like ffmpeg can be compiled with support --enable-libamr-nb --enable-libamr-wb.

Is recompiling ffmpeg an option?

-1
votes

I resolved this issue. Here my code:

<?php
   define('FFMPEG_LIBRARY', '/usr/local/bin/ffmpeg');
   $exec_string = FFMPEG_LIBRARY.' -i robot.avi -an output.flv';
   exec($exec_string); //where exec is the command used to execute shell command in php
?>