Is it safe to omit the codec when converting with ffmpeg?Would like to change audio codec, but keep video...
The No-Straight Maze
Subsurf on a crown. How can I smooth some edges and keep others sharp?
Does an Eldritch Knight's Weapon Bond protect him from losing his weapon to a Telekinesis spell?
Does the ditching switch allow an A320 to float indefinitely?
Do authors have to be politically correct in article-writing?
Why does 0.-5 evaluate to -5?
Square Root Distance from Integers
Does a paladin have to announce that they're using Divine Smite before attacking?
A starship is travelling at 0.9c and collides with a small rock. Will it leave a clean hole through, or will more happen?
In harmony: key or the flow?
Count repetitions of an array
Are the positive and negative planes inner or outer planes in the Great Wheel cosmology model?
Broad Strokes - missing letter riddle
Prevent Nautilus / Nemo from creating .Trash-1000 folder in mounted devices
Why is one not obligated to give up his life rather than violate Lashon Hara?
What to do with threats of blacklisting?
Critique vs nitpicking
Not a Long-Winded Riddle
A fantasy book with seven white haired women on the cover
Converting very wide logos to square formats
What is the wife of a henpecked husband called?
Why did Luke use his left hand to shoot?
How would an AI self awareness kill switch work?
Does Skippy chunky peanut butter contain trans fat?
Is it safe to omit the codec when converting with ffmpeg?
Would like to change audio codec, but keep video settings with ffmpegIs it possible to get ffmpeg to work on Debian with support for amr codec (libopencore-amrnb) ahd h264 encoder (libx264)?Converting AVI encoded file with an IMM5 codecFix audio codec error with ffmpegffmpeg changing Codec ID?Keep input codecsUnable to re-encode audio stream with different bitrate using ffmpegConvert videos to MP4 iPad (h264 and aac), but leave video codec alone if h264 alreadyChanging the codec while keeping the bitrate with ffmpegFFMpeg Video Overlay with Delayed Audio and Video in Background Video
I noticed today that I could encode or transcode video and audio streams using ffmpeg
without specifying a codec, due to the fact that it seems to imply the video or audio codec being encoded or transcoded to from the extension of the output. This means that:
ffmpeg "input.mp3" -c:a aac "output.m4a"
...can be replaced by:
ffmpeg "input.mp3" "output.m4a"
In addition:
ffmpeg "input.dts" -c:a copy -ac 2 "output.dts"
...can be replaced by:
ffmpeg "input.dts" -ac 2 "output.dts"
Given that always explicitly including the codec is the most popular way to use ffmpeg
I've seen - on this site in particular - I wondered whether there were reasons for this to be the case.
Are there any possible pitfalls to consider when using ffmpeg
to encode in this way? Is it safe to assume that it would result in exactly the same conversion that explicitly specifying a codec might?
audio video ffmpeg codec transcode
|
show 2 more comments
I noticed today that I could encode or transcode video and audio streams using ffmpeg
without specifying a codec, due to the fact that it seems to imply the video or audio codec being encoded or transcoded to from the extension of the output. This means that:
ffmpeg "input.mp3" -c:a aac "output.m4a"
...can be replaced by:
ffmpeg "input.mp3" "output.m4a"
In addition:
ffmpeg "input.dts" -c:a copy -ac 2 "output.dts"
...can be replaced by:
ffmpeg "input.dts" -ac 2 "output.dts"
Given that always explicitly including the codec is the most popular way to use ffmpeg
I've seen - on this site in particular - I wondered whether there were reasons for this to be the case.
Are there any possible pitfalls to consider when using ffmpeg
to encode in this way? Is it safe to assume that it would result in exactly the same conversion that explicitly specifying a codec might?
audio video ffmpeg codec transcode
1
You don't need the-ac 2
in your third command: it's being ignored since you are only re-muxing (stream copying). Your fourth command is not the same as the third: it will re-encode while the previous command just re-muxes.
– llogan
5 hours ago
@llogan Great catch. I tested the conversion with a.dts
file I had but forgot to check whether the output was actually stereo. So to confirm - any changes made to a stream can only be made if the stream is re-encoded, and a re-encode can only happen if the stream is not copied?
– Hashim
5 hours ago
1
Yes to both questions
– llogan
4 hours ago
@llogan Interesting. Is there a way to use FFmpeg to use the same codec as the input for the output, while still getting it to re-encode?
– Hashim
4 hours ago
1
There is no internal setting for this, but one option is to useffprobe
to get thecodec_name
, which can roughly correlate to an encoder name, then use if/then statements in your favorite scripting language. IIRC, other users have asked this same question on the Stack Exchange network, so there are probably some examples.
– llogan
4 hours ago
|
show 2 more comments
I noticed today that I could encode or transcode video and audio streams using ffmpeg
without specifying a codec, due to the fact that it seems to imply the video or audio codec being encoded or transcoded to from the extension of the output. This means that:
ffmpeg "input.mp3" -c:a aac "output.m4a"
...can be replaced by:
ffmpeg "input.mp3" "output.m4a"
In addition:
ffmpeg "input.dts" -c:a copy -ac 2 "output.dts"
...can be replaced by:
ffmpeg "input.dts" -ac 2 "output.dts"
Given that always explicitly including the codec is the most popular way to use ffmpeg
I've seen - on this site in particular - I wondered whether there were reasons for this to be the case.
Are there any possible pitfalls to consider when using ffmpeg
to encode in this way? Is it safe to assume that it would result in exactly the same conversion that explicitly specifying a codec might?
audio video ffmpeg codec transcode
I noticed today that I could encode or transcode video and audio streams using ffmpeg
without specifying a codec, due to the fact that it seems to imply the video or audio codec being encoded or transcoded to from the extension of the output. This means that:
ffmpeg "input.mp3" -c:a aac "output.m4a"
...can be replaced by:
ffmpeg "input.mp3" "output.m4a"
In addition:
ffmpeg "input.dts" -c:a copy -ac 2 "output.dts"
...can be replaced by:
ffmpeg "input.dts" -ac 2 "output.dts"
Given that always explicitly including the codec is the most popular way to use ffmpeg
I've seen - on this site in particular - I wondered whether there were reasons for this to be the case.
Are there any possible pitfalls to consider when using ffmpeg
to encode in this way? Is it safe to assume that it would result in exactly the same conversion that explicitly specifying a codec might?
audio video ffmpeg codec transcode
audio video ffmpeg codec transcode
edited 3 hours ago
Hashim
asked 6 hours ago
HashimHashim
3,09663162
3,09663162
1
You don't need the-ac 2
in your third command: it's being ignored since you are only re-muxing (stream copying). Your fourth command is not the same as the third: it will re-encode while the previous command just re-muxes.
– llogan
5 hours ago
@llogan Great catch. I tested the conversion with a.dts
file I had but forgot to check whether the output was actually stereo. So to confirm - any changes made to a stream can only be made if the stream is re-encoded, and a re-encode can only happen if the stream is not copied?
– Hashim
5 hours ago
1
Yes to both questions
– llogan
4 hours ago
@llogan Interesting. Is there a way to use FFmpeg to use the same codec as the input for the output, while still getting it to re-encode?
– Hashim
4 hours ago
1
There is no internal setting for this, but one option is to useffprobe
to get thecodec_name
, which can roughly correlate to an encoder name, then use if/then statements in your favorite scripting language. IIRC, other users have asked this same question on the Stack Exchange network, so there are probably some examples.
– llogan
4 hours ago
|
show 2 more comments
1
You don't need the-ac 2
in your third command: it's being ignored since you are only re-muxing (stream copying). Your fourth command is not the same as the third: it will re-encode while the previous command just re-muxes.
– llogan
5 hours ago
@llogan Great catch. I tested the conversion with a.dts
file I had but forgot to check whether the output was actually stereo. So to confirm - any changes made to a stream can only be made if the stream is re-encoded, and a re-encode can only happen if the stream is not copied?
– Hashim
5 hours ago
1
Yes to both questions
– llogan
4 hours ago
@llogan Interesting. Is there a way to use FFmpeg to use the same codec as the input for the output, while still getting it to re-encode?
– Hashim
4 hours ago
1
There is no internal setting for this, but one option is to useffprobe
to get thecodec_name
, which can roughly correlate to an encoder name, then use if/then statements in your favorite scripting language. IIRC, other users have asked this same question on the Stack Exchange network, so there are probably some examples.
– llogan
4 hours ago
1
1
You don't need the
-ac 2
in your third command: it's being ignored since you are only re-muxing (stream copying). Your fourth command is not the same as the third: it will re-encode while the previous command just re-muxes.– llogan
5 hours ago
You don't need the
-ac 2
in your third command: it's being ignored since you are only re-muxing (stream copying). Your fourth command is not the same as the third: it will re-encode while the previous command just re-muxes.– llogan
5 hours ago
@llogan Great catch. I tested the conversion with a
.dts
file I had but forgot to check whether the output was actually stereo. So to confirm - any changes made to a stream can only be made if the stream is re-encoded, and a re-encode can only happen if the stream is not copied?– Hashim
5 hours ago
@llogan Great catch. I tested the conversion with a
.dts
file I had but forgot to check whether the output was actually stereo. So to confirm - any changes made to a stream can only be made if the stream is re-encoded, and a re-encode can only happen if the stream is not copied?– Hashim
5 hours ago
1
1
Yes to both questions
– llogan
4 hours ago
Yes to both questions
– llogan
4 hours ago
@llogan Interesting. Is there a way to use FFmpeg to use the same codec as the input for the output, while still getting it to re-encode?
– Hashim
4 hours ago
@llogan Interesting. Is there a way to use FFmpeg to use the same codec as the input for the output, while still getting it to re-encode?
– Hashim
4 hours ago
1
1
There is no internal setting for this, but one option is to use
ffprobe
to get the codec_name
, which can roughly correlate to an encoder name, then use if/then statements in your favorite scripting language. IIRC, other users have asked this same question on the Stack Exchange network, so there are probably some examples.– llogan
4 hours ago
There is no internal setting for this, but one option is to use
ffprobe
to get the codec_name
, which can roughly correlate to an encoder name, then use if/then statements in your favorite scripting language. IIRC, other users have asked this same question on the Stack Exchange network, so there are probably some examples.– llogan
4 hours ago
|
show 2 more comments
2 Answers
2
active
oldest
votes
It's best to specify the encoder
Some of the default selections are legacy or weird. For example:
flv1
is chosen for FLV output. Most people expect H.264 (libx264).flac
is chosen for OGG/OGA output. Most people expect Vorbis (libvorbis).
The encoder used as the default for an output format can depend on which configure options were used to compile your
ffmpeg
. So if yourffmpeg
does not have--enable-libx264
, then for MP4 the encoder mpeg4 (MPEG-4 Part 2 video) is used instead of libx264 (H.264 video). Most people useffmpeg
builds with support for the most popular libraries included, but it happens on occasion.It's not much work to be specific.
But sometimes you can be lazy
If you know what encoders are going to be chosen, or if you check and verify, then you can save a few keystrokes if you want. Refer to Stream mapping in the console output to see what encoders ffmpeg
uses. Example:
ffmpeg -i input.foo output.mp4
...
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
In this case it is using libx264 for video (-c:v libx264
), and the native AAC encoder for audio (-c:a aac
).
You can view details on a specific muxer to see what codecs will be used by default:
ffmpeg -h muxer=mp4
...
Muxer mp4 [MP4 (MPEG-4 Part 14)]:
Default video codec: h264.
Default audio codec: aac.
Great answer, this is the kind of intimate knowledge of FFmpeg I was relying on to get an answer to this question. I noticed that your website says you're an FFmpeg developer. Is there any particular reason for the first point - FFmpeg using legacy/weird encoders - and is there a possibility that they'll change/become more up to date anytime soon?
– Hashim
5 hours ago
Since posting the question, I also noticed that the FFmpeg website uses the simpler syntax on its homepage, so is clearly trying to encourage such use for beginners, and I have to admit the codec syntax and how complicated it looks had, prior to this week, been a barrier to learning how to useffmpeg
for a while.
– Hashim
5 hours ago
@Hashim Regarding the legacy encoders, sometimes things are updated (webm now uses libbpx-vp9 & libopus by default for example), but sometimes things languish. I'd be fine with updating some defaults to more modern, sane, or useful values, but I imagine some of the more argumentative developers would balk at some changes, and may suggest it will confuse users (not that the legacy stuff isn't confusing), so some settings stay the same indefinitely.
– llogan
4 hours ago
That's a real shame. When you use a program likeffmpeg
with the pedigree that it has, you'd expect its defaults to be both current and optimised for the majority of people, I hope something changes soon on that front. Thanks regardless for all your help.
– Hashim
3 hours ago
add a comment |
Is it safe to assume that it would result in exactly the same
conversion that explicitly specifying a codec might
Not necessarily. It is "safe" in that you will get a file that works. Ffmpeg will pick a preferred codec that works with that container. However using a different file extension MAY choose a different codec. Also the preferred codec could change in the future, or based on how Ffmpeg was compiled.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1409379%2fis-it-safe-to-omit-the-codec-when-converting-with-ffmpeg%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
It's best to specify the encoder
Some of the default selections are legacy or weird. For example:
flv1
is chosen for FLV output. Most people expect H.264 (libx264).flac
is chosen for OGG/OGA output. Most people expect Vorbis (libvorbis).
The encoder used as the default for an output format can depend on which configure options were used to compile your
ffmpeg
. So if yourffmpeg
does not have--enable-libx264
, then for MP4 the encoder mpeg4 (MPEG-4 Part 2 video) is used instead of libx264 (H.264 video). Most people useffmpeg
builds with support for the most popular libraries included, but it happens on occasion.It's not much work to be specific.
But sometimes you can be lazy
If you know what encoders are going to be chosen, or if you check and verify, then you can save a few keystrokes if you want. Refer to Stream mapping in the console output to see what encoders ffmpeg
uses. Example:
ffmpeg -i input.foo output.mp4
...
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
In this case it is using libx264 for video (-c:v libx264
), and the native AAC encoder for audio (-c:a aac
).
You can view details on a specific muxer to see what codecs will be used by default:
ffmpeg -h muxer=mp4
...
Muxer mp4 [MP4 (MPEG-4 Part 14)]:
Default video codec: h264.
Default audio codec: aac.
Great answer, this is the kind of intimate knowledge of FFmpeg I was relying on to get an answer to this question. I noticed that your website says you're an FFmpeg developer. Is there any particular reason for the first point - FFmpeg using legacy/weird encoders - and is there a possibility that they'll change/become more up to date anytime soon?
– Hashim
5 hours ago
Since posting the question, I also noticed that the FFmpeg website uses the simpler syntax on its homepage, so is clearly trying to encourage such use for beginners, and I have to admit the codec syntax and how complicated it looks had, prior to this week, been a barrier to learning how to useffmpeg
for a while.
– Hashim
5 hours ago
@Hashim Regarding the legacy encoders, sometimes things are updated (webm now uses libbpx-vp9 & libopus by default for example), but sometimes things languish. I'd be fine with updating some defaults to more modern, sane, or useful values, but I imagine some of the more argumentative developers would balk at some changes, and may suggest it will confuse users (not that the legacy stuff isn't confusing), so some settings stay the same indefinitely.
– llogan
4 hours ago
That's a real shame. When you use a program likeffmpeg
with the pedigree that it has, you'd expect its defaults to be both current and optimised for the majority of people, I hope something changes soon on that front. Thanks regardless for all your help.
– Hashim
3 hours ago
add a comment |
It's best to specify the encoder
Some of the default selections are legacy or weird. For example:
flv1
is chosen for FLV output. Most people expect H.264 (libx264).flac
is chosen for OGG/OGA output. Most people expect Vorbis (libvorbis).
The encoder used as the default for an output format can depend on which configure options were used to compile your
ffmpeg
. So if yourffmpeg
does not have--enable-libx264
, then for MP4 the encoder mpeg4 (MPEG-4 Part 2 video) is used instead of libx264 (H.264 video). Most people useffmpeg
builds with support for the most popular libraries included, but it happens on occasion.It's not much work to be specific.
But sometimes you can be lazy
If you know what encoders are going to be chosen, or if you check and verify, then you can save a few keystrokes if you want. Refer to Stream mapping in the console output to see what encoders ffmpeg
uses. Example:
ffmpeg -i input.foo output.mp4
...
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
In this case it is using libx264 for video (-c:v libx264
), and the native AAC encoder for audio (-c:a aac
).
You can view details on a specific muxer to see what codecs will be used by default:
ffmpeg -h muxer=mp4
...
Muxer mp4 [MP4 (MPEG-4 Part 14)]:
Default video codec: h264.
Default audio codec: aac.
Great answer, this is the kind of intimate knowledge of FFmpeg I was relying on to get an answer to this question. I noticed that your website says you're an FFmpeg developer. Is there any particular reason for the first point - FFmpeg using legacy/weird encoders - and is there a possibility that they'll change/become more up to date anytime soon?
– Hashim
5 hours ago
Since posting the question, I also noticed that the FFmpeg website uses the simpler syntax on its homepage, so is clearly trying to encourage such use for beginners, and I have to admit the codec syntax and how complicated it looks had, prior to this week, been a barrier to learning how to useffmpeg
for a while.
– Hashim
5 hours ago
@Hashim Regarding the legacy encoders, sometimes things are updated (webm now uses libbpx-vp9 & libopus by default for example), but sometimes things languish. I'd be fine with updating some defaults to more modern, sane, or useful values, but I imagine some of the more argumentative developers would balk at some changes, and may suggest it will confuse users (not that the legacy stuff isn't confusing), so some settings stay the same indefinitely.
– llogan
4 hours ago
That's a real shame. When you use a program likeffmpeg
with the pedigree that it has, you'd expect its defaults to be both current and optimised for the majority of people, I hope something changes soon on that front. Thanks regardless for all your help.
– Hashim
3 hours ago
add a comment |
It's best to specify the encoder
Some of the default selections are legacy or weird. For example:
flv1
is chosen for FLV output. Most people expect H.264 (libx264).flac
is chosen for OGG/OGA output. Most people expect Vorbis (libvorbis).
The encoder used as the default for an output format can depend on which configure options were used to compile your
ffmpeg
. So if yourffmpeg
does not have--enable-libx264
, then for MP4 the encoder mpeg4 (MPEG-4 Part 2 video) is used instead of libx264 (H.264 video). Most people useffmpeg
builds with support for the most popular libraries included, but it happens on occasion.It's not much work to be specific.
But sometimes you can be lazy
If you know what encoders are going to be chosen, or if you check and verify, then you can save a few keystrokes if you want. Refer to Stream mapping in the console output to see what encoders ffmpeg
uses. Example:
ffmpeg -i input.foo output.mp4
...
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
In this case it is using libx264 for video (-c:v libx264
), and the native AAC encoder for audio (-c:a aac
).
You can view details on a specific muxer to see what codecs will be used by default:
ffmpeg -h muxer=mp4
...
Muxer mp4 [MP4 (MPEG-4 Part 14)]:
Default video codec: h264.
Default audio codec: aac.
It's best to specify the encoder
Some of the default selections are legacy or weird. For example:
flv1
is chosen for FLV output. Most people expect H.264 (libx264).flac
is chosen for OGG/OGA output. Most people expect Vorbis (libvorbis).
The encoder used as the default for an output format can depend on which configure options were used to compile your
ffmpeg
. So if yourffmpeg
does not have--enable-libx264
, then for MP4 the encoder mpeg4 (MPEG-4 Part 2 video) is used instead of libx264 (H.264 video). Most people useffmpeg
builds with support for the most popular libraries included, but it happens on occasion.It's not much work to be specific.
But sometimes you can be lazy
If you know what encoders are going to be chosen, or if you check and verify, then you can save a few keystrokes if you want. Refer to Stream mapping in the console output to see what encoders ffmpeg
uses. Example:
ffmpeg -i input.foo output.mp4
...
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
In this case it is using libx264 for video (-c:v libx264
), and the native AAC encoder for audio (-c:a aac
).
You can view details on a specific muxer to see what codecs will be used by default:
ffmpeg -h muxer=mp4
...
Muxer mp4 [MP4 (MPEG-4 Part 14)]:
Default video codec: h264.
Default audio codec: aac.
answered 6 hours ago
lloganllogan
25.8k54782
25.8k54782
Great answer, this is the kind of intimate knowledge of FFmpeg I was relying on to get an answer to this question. I noticed that your website says you're an FFmpeg developer. Is there any particular reason for the first point - FFmpeg using legacy/weird encoders - and is there a possibility that they'll change/become more up to date anytime soon?
– Hashim
5 hours ago
Since posting the question, I also noticed that the FFmpeg website uses the simpler syntax on its homepage, so is clearly trying to encourage such use for beginners, and I have to admit the codec syntax and how complicated it looks had, prior to this week, been a barrier to learning how to useffmpeg
for a while.
– Hashim
5 hours ago
@Hashim Regarding the legacy encoders, sometimes things are updated (webm now uses libbpx-vp9 & libopus by default for example), but sometimes things languish. I'd be fine with updating some defaults to more modern, sane, or useful values, but I imagine some of the more argumentative developers would balk at some changes, and may suggest it will confuse users (not that the legacy stuff isn't confusing), so some settings stay the same indefinitely.
– llogan
4 hours ago
That's a real shame. When you use a program likeffmpeg
with the pedigree that it has, you'd expect its defaults to be both current and optimised for the majority of people, I hope something changes soon on that front. Thanks regardless for all your help.
– Hashim
3 hours ago
add a comment |
Great answer, this is the kind of intimate knowledge of FFmpeg I was relying on to get an answer to this question. I noticed that your website says you're an FFmpeg developer. Is there any particular reason for the first point - FFmpeg using legacy/weird encoders - and is there a possibility that they'll change/become more up to date anytime soon?
– Hashim
5 hours ago
Since posting the question, I also noticed that the FFmpeg website uses the simpler syntax on its homepage, so is clearly trying to encourage such use for beginners, and I have to admit the codec syntax and how complicated it looks had, prior to this week, been a barrier to learning how to useffmpeg
for a while.
– Hashim
5 hours ago
@Hashim Regarding the legacy encoders, sometimes things are updated (webm now uses libbpx-vp9 & libopus by default for example), but sometimes things languish. I'd be fine with updating some defaults to more modern, sane, or useful values, but I imagine some of the more argumentative developers would balk at some changes, and may suggest it will confuse users (not that the legacy stuff isn't confusing), so some settings stay the same indefinitely.
– llogan
4 hours ago
That's a real shame. When you use a program likeffmpeg
with the pedigree that it has, you'd expect its defaults to be both current and optimised for the majority of people, I hope something changes soon on that front. Thanks regardless for all your help.
– Hashim
3 hours ago
Great answer, this is the kind of intimate knowledge of FFmpeg I was relying on to get an answer to this question. I noticed that your website says you're an FFmpeg developer. Is there any particular reason for the first point - FFmpeg using legacy/weird encoders - and is there a possibility that they'll change/become more up to date anytime soon?
– Hashim
5 hours ago
Great answer, this is the kind of intimate knowledge of FFmpeg I was relying on to get an answer to this question. I noticed that your website says you're an FFmpeg developer. Is there any particular reason for the first point - FFmpeg using legacy/weird encoders - and is there a possibility that they'll change/become more up to date anytime soon?
– Hashim
5 hours ago
Since posting the question, I also noticed that the FFmpeg website uses the simpler syntax on its homepage, so is clearly trying to encourage such use for beginners, and I have to admit the codec syntax and how complicated it looks had, prior to this week, been a barrier to learning how to use
ffmpeg
for a while.– Hashim
5 hours ago
Since posting the question, I also noticed that the FFmpeg website uses the simpler syntax on its homepage, so is clearly trying to encourage such use for beginners, and I have to admit the codec syntax and how complicated it looks had, prior to this week, been a barrier to learning how to use
ffmpeg
for a while.– Hashim
5 hours ago
@Hashim Regarding the legacy encoders, sometimes things are updated (webm now uses libbpx-vp9 & libopus by default for example), but sometimes things languish. I'd be fine with updating some defaults to more modern, sane, or useful values, but I imagine some of the more argumentative developers would balk at some changes, and may suggest it will confuse users (not that the legacy stuff isn't confusing), so some settings stay the same indefinitely.
– llogan
4 hours ago
@Hashim Regarding the legacy encoders, sometimes things are updated (webm now uses libbpx-vp9 & libopus by default for example), but sometimes things languish. I'd be fine with updating some defaults to more modern, sane, or useful values, but I imagine some of the more argumentative developers would balk at some changes, and may suggest it will confuse users (not that the legacy stuff isn't confusing), so some settings stay the same indefinitely.
– llogan
4 hours ago
That's a real shame. When you use a program like
ffmpeg
with the pedigree that it has, you'd expect its defaults to be both current and optimised for the majority of people, I hope something changes soon on that front. Thanks regardless for all your help.– Hashim
3 hours ago
That's a real shame. When you use a program like
ffmpeg
with the pedigree that it has, you'd expect its defaults to be both current and optimised for the majority of people, I hope something changes soon on that front. Thanks regardless for all your help.– Hashim
3 hours ago
add a comment |
Is it safe to assume that it would result in exactly the same
conversion that explicitly specifying a codec might
Not necessarily. It is "safe" in that you will get a file that works. Ffmpeg will pick a preferred codec that works with that container. However using a different file extension MAY choose a different codec. Also the preferred codec could change in the future, or based on how Ffmpeg was compiled.
add a comment |
Is it safe to assume that it would result in exactly the same
conversion that explicitly specifying a codec might
Not necessarily. It is "safe" in that you will get a file that works. Ffmpeg will pick a preferred codec that works with that container. However using a different file extension MAY choose a different codec. Also the preferred codec could change in the future, or based on how Ffmpeg was compiled.
add a comment |
Is it safe to assume that it would result in exactly the same
conversion that explicitly specifying a codec might
Not necessarily. It is "safe" in that you will get a file that works. Ffmpeg will pick a preferred codec that works with that container. However using a different file extension MAY choose a different codec. Also the preferred codec could change in the future, or based on how Ffmpeg was compiled.
Is it safe to assume that it would result in exactly the same
conversion that explicitly specifying a codec might
Not necessarily. It is "safe" in that you will get a file that works. Ffmpeg will pick a preferred codec that works with that container. However using a different file extension MAY choose a different codec. Also the preferred codec could change in the future, or based on how Ffmpeg was compiled.
answered 6 hours ago
szatmaryszatmary
1,759711
1,759711
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1409379%2fis-it-safe-to-omit-the-codec-when-converting-with-ffmpeg%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You don't need the
-ac 2
in your third command: it's being ignored since you are only re-muxing (stream copying). Your fourth command is not the same as the third: it will re-encode while the previous command just re-muxes.– llogan
5 hours ago
@llogan Great catch. I tested the conversion with a
.dts
file I had but forgot to check whether the output was actually stereo. So to confirm - any changes made to a stream can only be made if the stream is re-encoded, and a re-encode can only happen if the stream is not copied?– Hashim
5 hours ago
1
Yes to both questions
– llogan
4 hours ago
@llogan Interesting. Is there a way to use FFmpeg to use the same codec as the input for the output, while still getting it to re-encode?
– Hashim
4 hours ago
1
There is no internal setting for this, but one option is to use
ffprobe
to get thecodec_name
, which can roughly correlate to an encoder name, then use if/then statements in your favorite scripting language. IIRC, other users have asked this same question on the Stack Exchange network, so there are probably some examples.– llogan
4 hours ago