What's the difference between "-acodec" and "-c" in FFMPEG

I'm new to FFMPEG, and can't find much clear documentation on this specifically.

I'm concatenating 3 mp3's (I just want muxing, no encoding/transcoding).

Both of these commands seem to work fine. Is there any difference between using '-c' and '-acodec'?

ffmpeg -i "concat:a.mp3|b.mp3|c.mp3" -acodec copy out.mp3
ffmpeg -i "concat:a.mp3|b.mp3|c.mp3" -c copy out.mp3

I've searched Google for hours, I've found various documentation of ffmpeg but none that explain what -c or -acodec actually do. I think -c stands for 'codec' and -acodec stands for 'audio codec'?? What does each do / is there a difference / is one better?

Documentation I've found that doesn't help:

Also any suggestions on how to improve this most welcome (I just need to sequentially join together 3 mp3s).

Thanks.

9

2 Answers

-c or -codec is a generic stream selector, so you can use it to set the codec for any of the streams be they audio or video.

-acodec is a subset of that functionality that automatically scopes to Audio streams

-acodec:1 is the same as -codec:a:1 and indicates you are setting the codec for the second audio stream (the first audio stream is 0).

from your linked documentation: -c, -codec

-c[:stream_specifier] codec (input/output,per-stream) -codec[:stream_specifier] codec (input/output,per-stream)

Select an encoder (when used before an output file) or a decoder (when used before an input file) for one or more streams. codec is the

name of a decoder/encoder or a special value copy (output only) to indicate that the stream is not to be re-encoded.

-acodec

-acodec codec (input/output)

Set the audio codec. This is an alias for -codec:a.

there is also a -vcodec that works the same way for video streams.

so to put it all together consider this command from the docffmpeg -i INPUT -map 0 -c copy -c:v:1 libx264 -c:a:137 libvorbis OUTPUT

this is saying use the original codec for all the steams (-c copy), but for the second video stream use libx264 (-c:v:1 libx264), and for the 138th audio stream use libvorbis (-c:a:137 libvorbis).

so with -c you can control all the types of streams, whereas -acodec and -vcodec are just shortcuts for the audio or video subsets thereof.

2

To address your title.

Doing -c copy will copy both the audio codec (acodec) and the video codec (vcodec)

-c copy is the same as -acodec copy -vcodec copy

-c:a copy is the same as -acodec copy.

-c:v copy is the same as -vcodec copy

and of course you can specify a codec e.g. -vcodec libx264 or -c:v libx264

The -c stands for codec. You can alternatively write -codec e.g. -codec:a copy

and if you don't specify e.g. -acodec copy or -acodec blahblah or -codec:a ..., then it will pick some default codec. You can also say -vn for no video. so it doesn't copy video. or -an for no audio Remove audio from video file with FFmpeg

8

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like