<p>I know about the <code>-c copy</code> switch with ffmpeg, but this does not work with filters as it means "don't re-encode". But what I want is to have my output use the same stream formats as my input. So if I scale and remux some file "input.avi" at 1920x1080 to "output.mp4" at 1280x720 I want the video and audio streams to be in the same format (i.e. re-encoding is OK but don't use a different codec). </p>

<p>Currently I need to specifically choose the codecs otherwise ffmpeg will use some default codecs based on the <em>container</em>--not based on my <em>input formats</em>. Is there any switch for this?</p>

<p>Note that I want to retain the formats, the specific encoder is not really important. E.g. As long as I can get H264 I don't care if it uses libx264 or some other 'competitor'.</p>

<p>On a side note, does ffmpeg has a command to list the defaults per container, or is it only available in external documentation?</p>

CC BY-SA 3.0
2015-12-10T05:51:02.363Z
1) Not all containers support the same codecs. In your example, you posit a AVI -> MP4 remux. Well, MP4 spec doesn't support PCM audio, so a source AVI with that audio codec will fail encode to a MP4.
Gyan
CC BY-SA 3.0
2015-12-10T05:54:27.607Z
2) FFmpeg doesn't include a corresponding encoder for each codec decoder it has, so some streams it can read but not write. Again, encoding failure. AFAIK, you'll have to specify the codecs explicitly.
Gyan
CC BY-SA 3.0
2015-12-10T06:33:14.307Z
@Mulvya if the container doesn't support the codec it should just give an error--like normal. 1) Assume the user knows the target container can handle the codecs. 2) Assume that FFmpeg has encoders for the relevant formats. It seems my case should be pretty common, and that it would not be hard to implement such a "copy" switch.
jiggunjer
CC BY-SA 3.0
2015-12-10T07:05:07.930Z
`ffmpeg -h encoder=label` will list all the parameters that the encoder accepts. If a default is set, it's (usually) noted. So, for Xvid, you should run `ffmpeg -h encoder=libxvid`
Gyan
<ffmpeg><encoding>
FFMpeg encode with original codec
jiggunjer
# FFMpeg encode with original codec

(Asked by: username_0 on 2015-12-10)

I know about the `-c copy` switch with ffmpeg, but this does not work with filters as it means "don't re-encode". But what I want is to have my output use the same stream formats as my input. So if I scale and remux some file "input.avi" at 1920x1080 to "output.mp4" at 1280x720 I want the video and audio streams to be in the same format (i.e. re-encoding is OK but don't use a different codec).

Currently I need to specifically choose the codecs otherwise ffmpeg will use some default codecs based on the *container*--not based on my *input formats*. Is there any switch for this?

Note that I want to retain the formats, the specific encoder is not really important. E.g. As long as I can get H264 I don't care if it uses libx264 or some other 'competitor'.

On a side note, does ffmpeg has a command to list the defaults per container, or is it only available in external documentation?

**Tags:** ffmpeg, encoding

> **Comments:**
> **username_1**: 1) Not all containers support the same codecs. In your example, you posit a AVI -> MP4 remux. Well, MP4 spec doesn't support PCM audio, so a source AVI with that audio codec will fail encode to a MP4.  
> **username_1**: 2) FFmpeg doesn't include a corresponding encoder for each codec decoder it has, so some streams it can read but not write. Again, encoding failure. AFAIK, you'll have to specify the codecs explicitly.  
> **username_0**: @Mulvya if the container doesn't support the codec it should just give an error--like normal. 1) Assume the user knows the target container can handle the codecs. 2) Assume that FFmpeg has encoders for the relevant formats. It seems my case should be pretty common, and that it would not be hard to implement such a "copy" switch.  
> **username_1**: `ffmpeg -h encoder=label` will list all the parameters that the encoder accepts. If a default is set, it's (usually) noted. So, for Xvid, you should run `ffmpeg -h encoder=libxvid`  

---

## 0 answers

