ffmpeg transcode twice compress further?
I have a collection of avi videos (say A).
I first convert them into MPEG4 Part2 (say B) using ffmpeg -i ${inname} -vf scale=340:256,setsar=1:1 -q:v 1 -c:v mpeg4 -g 12 -f rawvideo ${outname}
. The total file size is 3.5G.
Then using B as input, I apply the same command to transcode B again into C, which has size 3.1G.
I thought B and C have the same format and thus should have the same file size? Why not and how can I resolve it to make sure no information loss in the second transcoding process?
video ffmpeg compression transcode mpeg4
|
show 2 more comments
I have a collection of avi videos (say A).
I first convert them into MPEG4 Part2 (say B) using ffmpeg -i ${inname} -vf scale=340:256,setsar=1:1 -q:v 1 -c:v mpeg4 -g 12 -f rawvideo ${outname}
. The total file size is 3.5G.
Then using B as input, I apply the same command to transcode B again into C, which has size 3.1G.
I thought B and C have the same format and thus should have the same file size? Why not and how can I resolve it to make sure no information loss in the second transcoding process?
video ffmpeg compression transcode mpeg4
2
Transcoding always looses data. Video encoding is lossy.
– Mokubai♦
Dec 22 '18 at 22:34
Thanks. But B and C have the same formats such as block size, number of p-frames, etc. It should be possible to make it lossless -- consider just duplicating B as C, right?
– apoliver
Dec 22 '18 at 23:42
By simply copying the video to a new container, yes. By transcoding, no. Ffmpeg supports copying using-c:v copy
– Mokubai♦
Dec 22 '18 at 23:47
Thanks. But my goal is not just copying. I'd like to learn which factors lead to this loss in the second stage and I want to avoid such second quality loss when I use other different codecs.
– apoliver
Dec 23 '18 at 0:49
BTW, by copying the video to a new container,-c:v copy
, do you mean that, say copy a video from H.264 to MPEG4 Part2, the format can still be changed to accommodate MPEG4 Part2 but no information loss? Thanks. Sorry that I am new to video compression... I guess the answer is no because I need to specify-c:v mpeg4
? or I just need to name the output as .mp4 ?
– apoliver
Dec 26 '18 at 16:57
|
show 2 more comments
I have a collection of avi videos (say A).
I first convert them into MPEG4 Part2 (say B) using ffmpeg -i ${inname} -vf scale=340:256,setsar=1:1 -q:v 1 -c:v mpeg4 -g 12 -f rawvideo ${outname}
. The total file size is 3.5G.
Then using B as input, I apply the same command to transcode B again into C, which has size 3.1G.
I thought B and C have the same format and thus should have the same file size? Why not and how can I resolve it to make sure no information loss in the second transcoding process?
video ffmpeg compression transcode mpeg4
I have a collection of avi videos (say A).
I first convert them into MPEG4 Part2 (say B) using ffmpeg -i ${inname} -vf scale=340:256,setsar=1:1 -q:v 1 -c:v mpeg4 -g 12 -f rawvideo ${outname}
. The total file size is 3.5G.
Then using B as input, I apply the same command to transcode B again into C, which has size 3.1G.
I thought B and C have the same format and thus should have the same file size? Why not and how can I resolve it to make sure no information loss in the second transcoding process?
video ffmpeg compression transcode mpeg4
video ffmpeg compression transcode mpeg4
asked Dec 22 '18 at 21:16
apoliverapoliver
61
61
2
Transcoding always looses data. Video encoding is lossy.
– Mokubai♦
Dec 22 '18 at 22:34
Thanks. But B and C have the same formats such as block size, number of p-frames, etc. It should be possible to make it lossless -- consider just duplicating B as C, right?
– apoliver
Dec 22 '18 at 23:42
By simply copying the video to a new container, yes. By transcoding, no. Ffmpeg supports copying using-c:v copy
– Mokubai♦
Dec 22 '18 at 23:47
Thanks. But my goal is not just copying. I'd like to learn which factors lead to this loss in the second stage and I want to avoid such second quality loss when I use other different codecs.
– apoliver
Dec 23 '18 at 0:49
BTW, by copying the video to a new container,-c:v copy
, do you mean that, say copy a video from H.264 to MPEG4 Part2, the format can still be changed to accommodate MPEG4 Part2 but no information loss? Thanks. Sorry that I am new to video compression... I guess the answer is no because I need to specify-c:v mpeg4
? or I just need to name the output as .mp4 ?
– apoliver
Dec 26 '18 at 16:57
|
show 2 more comments
2
Transcoding always looses data. Video encoding is lossy.
– Mokubai♦
Dec 22 '18 at 22:34
Thanks. But B and C have the same formats such as block size, number of p-frames, etc. It should be possible to make it lossless -- consider just duplicating B as C, right?
– apoliver
Dec 22 '18 at 23:42
By simply copying the video to a new container, yes. By transcoding, no. Ffmpeg supports copying using-c:v copy
– Mokubai♦
Dec 22 '18 at 23:47
Thanks. But my goal is not just copying. I'd like to learn which factors lead to this loss in the second stage and I want to avoid such second quality loss when I use other different codecs.
– apoliver
Dec 23 '18 at 0:49
BTW, by copying the video to a new container,-c:v copy
, do you mean that, say copy a video from H.264 to MPEG4 Part2, the format can still be changed to accommodate MPEG4 Part2 but no information loss? Thanks. Sorry that I am new to video compression... I guess the answer is no because I need to specify-c:v mpeg4
? or I just need to name the output as .mp4 ?
– apoliver
Dec 26 '18 at 16:57
2
2
Transcoding always looses data. Video encoding is lossy.
– Mokubai♦
Dec 22 '18 at 22:34
Transcoding always looses data. Video encoding is lossy.
– Mokubai♦
Dec 22 '18 at 22:34
Thanks. But B and C have the same formats such as block size, number of p-frames, etc. It should be possible to make it lossless -- consider just duplicating B as C, right?
– apoliver
Dec 22 '18 at 23:42
Thanks. But B and C have the same formats such as block size, number of p-frames, etc. It should be possible to make it lossless -- consider just duplicating B as C, right?
– apoliver
Dec 22 '18 at 23:42
By simply copying the video to a new container, yes. By transcoding, no. Ffmpeg supports copying using
-c:v copy
– Mokubai♦
Dec 22 '18 at 23:47
By simply copying the video to a new container, yes. By transcoding, no. Ffmpeg supports copying using
-c:v copy
– Mokubai♦
Dec 22 '18 at 23:47
Thanks. But my goal is not just copying. I'd like to learn which factors lead to this loss in the second stage and I want to avoid such second quality loss when I use other different codecs.
– apoliver
Dec 23 '18 at 0:49
Thanks. But my goal is not just copying. I'd like to learn which factors lead to this loss in the second stage and I want to avoid such second quality loss when I use other different codecs.
– apoliver
Dec 23 '18 at 0:49
BTW, by copying the video to a new container,
-c:v copy
, do you mean that, say copy a video from H.264 to MPEG4 Part2, the format can still be changed to accommodate MPEG4 Part2 but no information loss? Thanks. Sorry that I am new to video compression... I guess the answer is no because I need to specify -c:v mpeg4
? or I just need to name the output as .mp4 ?– apoliver
Dec 26 '18 at 16:57
BTW, by copying the video to a new container,
-c:v copy
, do you mean that, say copy a video from H.264 to MPEG4 Part2, the format can still be changed to accommodate MPEG4 Part2 but no information loss? Thanks. Sorry that I am new to video compression... I guess the answer is no because I need to specify -c:v mpeg4
? or I just need to name the output as .mp4 ?– apoliver
Dec 26 '18 at 16:57
|
show 2 more comments
1 Answer
1
active
oldest
votes
Your procedure is like:
- (source) A → B (result)
- (source) B → C (result)
Lossy encoding produces video that is different from its source, so frames of B are different than frames of A. This means the two sources in the above procedure are different.
I thought B and C have the same format and thus should have the same file size? Why not?
Because they are produced from different source videos.
how can I resolve it to make sure no information loss in the second transcoding process?
- Use lossless encoding
- or do not transcode more than once.
Thanks. I described the actual issue/reason leading my this question in another question transcode-loss-information. Could you take a look?
– apoliver
Dec 25 '18 at 22:11
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%2f1387007%2fffmpeg-transcode-twice-compress-further%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your procedure is like:
- (source) A → B (result)
- (source) B → C (result)
Lossy encoding produces video that is different from its source, so frames of B are different than frames of A. This means the two sources in the above procedure are different.
I thought B and C have the same format and thus should have the same file size? Why not?
Because they are produced from different source videos.
how can I resolve it to make sure no information loss in the second transcoding process?
- Use lossless encoding
- or do not transcode more than once.
Thanks. I described the actual issue/reason leading my this question in another question transcode-loss-information. Could you take a look?
– apoliver
Dec 25 '18 at 22:11
add a comment |
Your procedure is like:
- (source) A → B (result)
- (source) B → C (result)
Lossy encoding produces video that is different from its source, so frames of B are different than frames of A. This means the two sources in the above procedure are different.
I thought B and C have the same format and thus should have the same file size? Why not?
Because they are produced from different source videos.
how can I resolve it to make sure no information loss in the second transcoding process?
- Use lossless encoding
- or do not transcode more than once.
Thanks. I described the actual issue/reason leading my this question in another question transcode-loss-information. Could you take a look?
– apoliver
Dec 25 '18 at 22:11
add a comment |
Your procedure is like:
- (source) A → B (result)
- (source) B → C (result)
Lossy encoding produces video that is different from its source, so frames of B are different than frames of A. This means the two sources in the above procedure are different.
I thought B and C have the same format and thus should have the same file size? Why not?
Because they are produced from different source videos.
how can I resolve it to make sure no information loss in the second transcoding process?
- Use lossless encoding
- or do not transcode more than once.
Your procedure is like:
- (source) A → B (result)
- (source) B → C (result)
Lossy encoding produces video that is different from its source, so frames of B are different than frames of A. This means the two sources in the above procedure are different.
I thought B and C have the same format and thus should have the same file size? Why not?
Because they are produced from different source videos.
how can I resolve it to make sure no information loss in the second transcoding process?
- Use lossless encoding
- or do not transcode more than once.
answered Dec 23 '18 at 7:06
Kamil MaciorowskiKamil Maciorowski
25.8k155578
25.8k155578
Thanks. I described the actual issue/reason leading my this question in another question transcode-loss-information. Could you take a look?
– apoliver
Dec 25 '18 at 22:11
add a comment |
Thanks. I described the actual issue/reason leading my this question in another question transcode-loss-information. Could you take a look?
– apoliver
Dec 25 '18 at 22:11
Thanks. I described the actual issue/reason leading my this question in another question transcode-loss-information. Could you take a look?
– apoliver
Dec 25 '18 at 22:11
Thanks. I described the actual issue/reason leading my this question in another question transcode-loss-information. Could you take a look?
– apoliver
Dec 25 '18 at 22:11
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%2f1387007%2fffmpeg-transcode-twice-compress-further%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
2
Transcoding always looses data. Video encoding is lossy.
– Mokubai♦
Dec 22 '18 at 22:34
Thanks. But B and C have the same formats such as block size, number of p-frames, etc. It should be possible to make it lossless -- consider just duplicating B as C, right?
– apoliver
Dec 22 '18 at 23:42
By simply copying the video to a new container, yes. By transcoding, no. Ffmpeg supports copying using
-c:v copy
– Mokubai♦
Dec 22 '18 at 23:47
Thanks. But my goal is not just copying. I'd like to learn which factors lead to this loss in the second stage and I want to avoid such second quality loss when I use other different codecs.
– apoliver
Dec 23 '18 at 0:49
BTW, by copying the video to a new container,
-c:v copy
, do you mean that, say copy a video from H.264 to MPEG4 Part2, the format can still be changed to accommodate MPEG4 Part2 but no information loss? Thanks. Sorry that I am new to video compression... I guess the answer is no because I need to specify-c:v mpeg4
? or I just need to name the output as .mp4 ?– apoliver
Dec 26 '18 at 16:57