[FFmpeg-user] Transcoding FLV with no/broken audio

Jon Drukman jsd at cluttered.com
Thu Nov 10 01:00:58 CET 2011

I'm using Red5 (open source Flash Media Server) to record videos from webcams.
Sometimes the files come through with no audio.  I want to transcode these
files to H.264/AAC, but if there's no audio, I'd like to just leave it out.

I can identify these bad input files by looking at ffmpeg's output:

Input #0, flv, from 'webcam.flv':
    audiocodecid    : -1
    duration        : 5
    videocodecid    : 2
    canSeekToEnd    : true
  Duration: 00:00:04.55, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: flv, yuv420p, 320x240, 1k tbr, 1k tbn, 1k tbc
    Stream #0.1: Audio: [0][0][0][0] / 0x0000, 0 channels

No problem.  Audio [0][0][0][0] means no audio.  But how do I specify that I
don't want any audio in the output? My normal command line is:

ffmpeg -v 0 -y -i webcam.flv -s 320x240 -acodec libfaac -ab 64k -ac 2
-ar 44100 -vcodec libx264 -preset fast -b 300k -bt 300k -threads 0
-vsync 0 -async 1 webcam.flv.mp4

This fails with:

Decoder (codec id 0) not found for input stream #0.1

I tried leaving off all the -acodec, -ab, -ac, -ar options.  This fails with:

[libfaac @ 0x7fa28c01b600] encoding 0 channel(s) is not allowed
Error while opening encoder for output stream #0.1 - maybe incorrect
parameters such as bit_rate, rate, width or height

I tried -acodec copy

[mp4 @ 0x7fe5fb818c00] sample rate not set
Could not write header for output file #0 (incorrect codec parameters ?)

I tried -acodec null, -acodec none... That just gives me "unknown encoder".

Any ideas how I can tell it to just ignore the audio entirely?

More information about the ffmpeg-user mailing list