FFMPEG and Bitrates
My goal is to figure out the most effective way of forwarding/restreaming a video in the m3u8 format by using FFMPEG. I do not mind bearing the cost of a CDN or extra servers however the ultimate goal is to deliver content at the following specification;
- 1280x720
- 30 FPS
- 1Mbit/s (1,000Kbits)
During the testing phase I am using the following placeholders:
Input: https://adultswimhls-i.akamaihd.net/hls/live/238460/adultswim/main/1/master.m3u8
Output: rtmp://a.rtmp.youtube.com/live2/xfiles
The current command I am using is;
ffmpeg -re -i https://adultswimhls-i.akamaihd.net/hls/live/238460/adultswim/main/1/master.m3u8 -c:a aac -c:v copy -f flv rtmp://a.rtmp.youtube.com/live2/xfiles
Current Resource Usage
After doing some research on SuperUser and a few other domains I believe that the -c:v copy
argument effectively mirrors the input source meaning my server is not re-encoding hence why the CPU usage is so light.
The second that I use a command like;
ffmpeg -re -i https://adultswimhls-i.akamaihd.net/hls/live/238460/adultswim/main/1/master.m3u8 -c:a aac -b:v 1M -b:a XXX -r 30 -s 1280x720 -f flv rtmp://a.rtmp.youtube.com/live2/xfiles (Not tested if this actually works, but just an example)
I notice the 5%~ CPU usage from the first command soon turns into a solid 60%+ and I am guessing thats because I am actually re-encoding. I am taking the input stream, applying said variables to it then re-encoding and pushing it to the desination which is understandable and upgrading my server is not an issue however I have to find out if I am ballsing something up. This is my first time using FFMPEG and I have done all the research I can possibly bring myself round to understanding hence why I am asking for somebody who knows their stuff. My thoughts are:
Find a CDN that offers encoding, waiting to hear back from BelugaCDN, I know one CDN provider offered it to me for $10 a month which was good, forgot which one though.
Seek for help in optimising the second command or finding someway to use
-c:v copy
and lower the bitrate to 1Mbit/s which I don't think is possible.Work out if its possible (not sure if anybody would know this or its more service based) to input the native bitrate stream when using a CDN but limit the outbound bitrate so the viewers are not sucking up crazy 5Mbit/s worth of bandwidth as the stream itself does not need to be that high of quality.
Upgrade my server so I can handle up to 3 simultaneous streams with me re-encoding, if so what specifications would I be looking to aim for.
Now I know you're likely thinking just use YouTube/Twitch its free... Well the video I am offering is a paid service and it just looks unprofessional therefore that would be my last resort.
Thank you for any help/advice.
linux ffmpeg streaming video-streaming
add a comment |
My goal is to figure out the most effective way of forwarding/restreaming a video in the m3u8 format by using FFMPEG. I do not mind bearing the cost of a CDN or extra servers however the ultimate goal is to deliver content at the following specification;
- 1280x720
- 30 FPS
- 1Mbit/s (1,000Kbits)
During the testing phase I am using the following placeholders:
Input: https://adultswimhls-i.akamaihd.net/hls/live/238460/adultswim/main/1/master.m3u8
Output: rtmp://a.rtmp.youtube.com/live2/xfiles
The current command I am using is;
ffmpeg -re -i https://adultswimhls-i.akamaihd.net/hls/live/238460/adultswim/main/1/master.m3u8 -c:a aac -c:v copy -f flv rtmp://a.rtmp.youtube.com/live2/xfiles
Current Resource Usage
After doing some research on SuperUser and a few other domains I believe that the -c:v copy
argument effectively mirrors the input source meaning my server is not re-encoding hence why the CPU usage is so light.
The second that I use a command like;
ffmpeg -re -i https://adultswimhls-i.akamaihd.net/hls/live/238460/adultswim/main/1/master.m3u8 -c:a aac -b:v 1M -b:a XXX -r 30 -s 1280x720 -f flv rtmp://a.rtmp.youtube.com/live2/xfiles (Not tested if this actually works, but just an example)
I notice the 5%~ CPU usage from the first command soon turns into a solid 60%+ and I am guessing thats because I am actually re-encoding. I am taking the input stream, applying said variables to it then re-encoding and pushing it to the desination which is understandable and upgrading my server is not an issue however I have to find out if I am ballsing something up. This is my first time using FFMPEG and I have done all the research I can possibly bring myself round to understanding hence why I am asking for somebody who knows their stuff. My thoughts are:
Find a CDN that offers encoding, waiting to hear back from BelugaCDN, I know one CDN provider offered it to me for $10 a month which was good, forgot which one though.
Seek for help in optimising the second command or finding someway to use
-c:v copy
and lower the bitrate to 1Mbit/s which I don't think is possible.Work out if its possible (not sure if anybody would know this or its more service based) to input the native bitrate stream when using a CDN but limit the outbound bitrate so the viewers are not sucking up crazy 5Mbit/s worth of bandwidth as the stream itself does not need to be that high of quality.
Upgrade my server so I can handle up to 3 simultaneous streams with me re-encoding, if so what specifications would I be looking to aim for.
Now I know you're likely thinking just use YouTube/Twitch its free... Well the video I am offering is a paid service and it just looks unprofessional therefore that would be my last resort.
Thank you for any help/advice.
linux ffmpeg streaming video-streaming
There are services such as Mux.com that do all this.
– szatmary
Dec 14 '18 at 20:10
I am looking into FFMPEG tweaks prior to reaching out to CDN's, even then Mux seems rather expensive compared to other solutions I have found.
– MrBlobby
Dec 15 '18 at 2:36
Yeah, it’s not cheep. But transcoding isn’t whether you buy a computer or rent one, it takes a lot of CPU to change the bitrate of a video.
– szatmary
Dec 15 '18 at 2:56
Note that depending on configuration you may hit the performance limit of your machine, aka it will no longer process 'real time'. There are various encoder options like multi-threading and real-time goal that can be enabled. Note that especially the latter lower quality in favor of fitting the time and bandwidth constraint.
– TBR
Dec 15 '18 at 17:46
@TBR, I was actually focusing on the wrong thing. After seeking advice from my server provider it turned out the load when running one encoder was between 0.5-1.0 with my "recommended" allowance being 3.0. I did not realise how CPU intensive re-encoding actually was. I am looking into my options of optimising the ffmpeg command above if you have any suggestions.
– MrBlobby
Dec 15 '18 at 19:16
add a comment |
My goal is to figure out the most effective way of forwarding/restreaming a video in the m3u8 format by using FFMPEG. I do not mind bearing the cost of a CDN or extra servers however the ultimate goal is to deliver content at the following specification;
- 1280x720
- 30 FPS
- 1Mbit/s (1,000Kbits)
During the testing phase I am using the following placeholders:
Input: https://adultswimhls-i.akamaihd.net/hls/live/238460/adultswim/main/1/master.m3u8
Output: rtmp://a.rtmp.youtube.com/live2/xfiles
The current command I am using is;
ffmpeg -re -i https://adultswimhls-i.akamaihd.net/hls/live/238460/adultswim/main/1/master.m3u8 -c:a aac -c:v copy -f flv rtmp://a.rtmp.youtube.com/live2/xfiles
Current Resource Usage
After doing some research on SuperUser and a few other domains I believe that the -c:v copy
argument effectively mirrors the input source meaning my server is not re-encoding hence why the CPU usage is so light.
The second that I use a command like;
ffmpeg -re -i https://adultswimhls-i.akamaihd.net/hls/live/238460/adultswim/main/1/master.m3u8 -c:a aac -b:v 1M -b:a XXX -r 30 -s 1280x720 -f flv rtmp://a.rtmp.youtube.com/live2/xfiles (Not tested if this actually works, but just an example)
I notice the 5%~ CPU usage from the first command soon turns into a solid 60%+ and I am guessing thats because I am actually re-encoding. I am taking the input stream, applying said variables to it then re-encoding and pushing it to the desination which is understandable and upgrading my server is not an issue however I have to find out if I am ballsing something up. This is my first time using FFMPEG and I have done all the research I can possibly bring myself round to understanding hence why I am asking for somebody who knows their stuff. My thoughts are:
Find a CDN that offers encoding, waiting to hear back from BelugaCDN, I know one CDN provider offered it to me for $10 a month which was good, forgot which one though.
Seek for help in optimising the second command or finding someway to use
-c:v copy
and lower the bitrate to 1Mbit/s which I don't think is possible.Work out if its possible (not sure if anybody would know this or its more service based) to input the native bitrate stream when using a CDN but limit the outbound bitrate so the viewers are not sucking up crazy 5Mbit/s worth of bandwidth as the stream itself does not need to be that high of quality.
Upgrade my server so I can handle up to 3 simultaneous streams with me re-encoding, if so what specifications would I be looking to aim for.
Now I know you're likely thinking just use YouTube/Twitch its free... Well the video I am offering is a paid service and it just looks unprofessional therefore that would be my last resort.
Thank you for any help/advice.
linux ffmpeg streaming video-streaming
My goal is to figure out the most effective way of forwarding/restreaming a video in the m3u8 format by using FFMPEG. I do not mind bearing the cost of a CDN or extra servers however the ultimate goal is to deliver content at the following specification;
- 1280x720
- 30 FPS
- 1Mbit/s (1,000Kbits)
During the testing phase I am using the following placeholders:
Input: https://adultswimhls-i.akamaihd.net/hls/live/238460/adultswim/main/1/master.m3u8
Output: rtmp://a.rtmp.youtube.com/live2/xfiles
The current command I am using is;
ffmpeg -re -i https://adultswimhls-i.akamaihd.net/hls/live/238460/adultswim/main/1/master.m3u8 -c:a aac -c:v copy -f flv rtmp://a.rtmp.youtube.com/live2/xfiles
Current Resource Usage
After doing some research on SuperUser and a few other domains I believe that the -c:v copy
argument effectively mirrors the input source meaning my server is not re-encoding hence why the CPU usage is so light.
The second that I use a command like;
ffmpeg -re -i https://adultswimhls-i.akamaihd.net/hls/live/238460/adultswim/main/1/master.m3u8 -c:a aac -b:v 1M -b:a XXX -r 30 -s 1280x720 -f flv rtmp://a.rtmp.youtube.com/live2/xfiles (Not tested if this actually works, but just an example)
I notice the 5%~ CPU usage from the first command soon turns into a solid 60%+ and I am guessing thats because I am actually re-encoding. I am taking the input stream, applying said variables to it then re-encoding and pushing it to the desination which is understandable and upgrading my server is not an issue however I have to find out if I am ballsing something up. This is my first time using FFMPEG and I have done all the research I can possibly bring myself round to understanding hence why I am asking for somebody who knows their stuff. My thoughts are:
Find a CDN that offers encoding, waiting to hear back from BelugaCDN, I know one CDN provider offered it to me for $10 a month which was good, forgot which one though.
Seek for help in optimising the second command or finding someway to use
-c:v copy
and lower the bitrate to 1Mbit/s which I don't think is possible.Work out if its possible (not sure if anybody would know this or its more service based) to input the native bitrate stream when using a CDN but limit the outbound bitrate so the viewers are not sucking up crazy 5Mbit/s worth of bandwidth as the stream itself does not need to be that high of quality.
Upgrade my server so I can handle up to 3 simultaneous streams with me re-encoding, if so what specifications would I be looking to aim for.
Now I know you're likely thinking just use YouTube/Twitch its free... Well the video I am offering is a paid service and it just looks unprofessional therefore that would be my last resort.
Thank you for any help/advice.
linux ffmpeg streaming video-streaming
linux ffmpeg streaming video-streaming
asked Dec 14 '18 at 17:40
MrBlobby
52
52
There are services such as Mux.com that do all this.
– szatmary
Dec 14 '18 at 20:10
I am looking into FFMPEG tweaks prior to reaching out to CDN's, even then Mux seems rather expensive compared to other solutions I have found.
– MrBlobby
Dec 15 '18 at 2:36
Yeah, it’s not cheep. But transcoding isn’t whether you buy a computer or rent one, it takes a lot of CPU to change the bitrate of a video.
– szatmary
Dec 15 '18 at 2:56
Note that depending on configuration you may hit the performance limit of your machine, aka it will no longer process 'real time'. There are various encoder options like multi-threading and real-time goal that can be enabled. Note that especially the latter lower quality in favor of fitting the time and bandwidth constraint.
– TBR
Dec 15 '18 at 17:46
@TBR, I was actually focusing on the wrong thing. After seeking advice from my server provider it turned out the load when running one encoder was between 0.5-1.0 with my "recommended" allowance being 3.0. I did not realise how CPU intensive re-encoding actually was. I am looking into my options of optimising the ffmpeg command above if you have any suggestions.
– MrBlobby
Dec 15 '18 at 19:16
add a comment |
There are services such as Mux.com that do all this.
– szatmary
Dec 14 '18 at 20:10
I am looking into FFMPEG tweaks prior to reaching out to CDN's, even then Mux seems rather expensive compared to other solutions I have found.
– MrBlobby
Dec 15 '18 at 2:36
Yeah, it’s not cheep. But transcoding isn’t whether you buy a computer or rent one, it takes a lot of CPU to change the bitrate of a video.
– szatmary
Dec 15 '18 at 2:56
Note that depending on configuration you may hit the performance limit of your machine, aka it will no longer process 'real time'. There are various encoder options like multi-threading and real-time goal that can be enabled. Note that especially the latter lower quality in favor of fitting the time and bandwidth constraint.
– TBR
Dec 15 '18 at 17:46
@TBR, I was actually focusing on the wrong thing. After seeking advice from my server provider it turned out the load when running one encoder was between 0.5-1.0 with my "recommended" allowance being 3.0. I did not realise how CPU intensive re-encoding actually was. I am looking into my options of optimising the ffmpeg command above if you have any suggestions.
– MrBlobby
Dec 15 '18 at 19:16
There are services such as Mux.com that do all this.
– szatmary
Dec 14 '18 at 20:10
There are services such as Mux.com that do all this.
– szatmary
Dec 14 '18 at 20:10
I am looking into FFMPEG tweaks prior to reaching out to CDN's, even then Mux seems rather expensive compared to other solutions I have found.
– MrBlobby
Dec 15 '18 at 2:36
I am looking into FFMPEG tweaks prior to reaching out to CDN's, even then Mux seems rather expensive compared to other solutions I have found.
– MrBlobby
Dec 15 '18 at 2:36
Yeah, it’s not cheep. But transcoding isn’t whether you buy a computer or rent one, it takes a lot of CPU to change the bitrate of a video.
– szatmary
Dec 15 '18 at 2:56
Yeah, it’s not cheep. But transcoding isn’t whether you buy a computer or rent one, it takes a lot of CPU to change the bitrate of a video.
– szatmary
Dec 15 '18 at 2:56
Note that depending on configuration you may hit the performance limit of your machine, aka it will no longer process 'real time'. There are various encoder options like multi-threading and real-time goal that can be enabled. Note that especially the latter lower quality in favor of fitting the time and bandwidth constraint.
– TBR
Dec 15 '18 at 17:46
Note that depending on configuration you may hit the performance limit of your machine, aka it will no longer process 'real time'. There are various encoder options like multi-threading and real-time goal that can be enabled. Note that especially the latter lower quality in favor of fitting the time and bandwidth constraint.
– TBR
Dec 15 '18 at 17:46
@TBR, I was actually focusing on the wrong thing. After seeking advice from my server provider it turned out the load when running one encoder was between 0.5-1.0 with my "recommended" allowance being 3.0. I did not realise how CPU intensive re-encoding actually was. I am looking into my options of optimising the ffmpeg command above if you have any suggestions.
– MrBlobby
Dec 15 '18 at 19:16
@TBR, I was actually focusing on the wrong thing. After seeking advice from my server provider it turned out the load when running one encoder was between 0.5-1.0 with my "recommended" allowance being 3.0. I did not realise how CPU intensive re-encoding actually was. I am looking into my options of optimising the ffmpeg command above if you have any suggestions.
– MrBlobby
Dec 15 '18 at 19:16
add a comment |
0
active
oldest
votes
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%2f1383653%2fffmpeg-and-bitrates%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f1383653%2fffmpeg-and-bitrates%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
There are services such as Mux.com that do all this.
– szatmary
Dec 14 '18 at 20:10
I am looking into FFMPEG tweaks prior to reaching out to CDN's, even then Mux seems rather expensive compared to other solutions I have found.
– MrBlobby
Dec 15 '18 at 2:36
Yeah, it’s not cheep. But transcoding isn’t whether you buy a computer or rent one, it takes a lot of CPU to change the bitrate of a video.
– szatmary
Dec 15 '18 at 2:56
Note that depending on configuration you may hit the performance limit of your machine, aka it will no longer process 'real time'. There are various encoder options like multi-threading and real-time goal that can be enabled. Note that especially the latter lower quality in favor of fitting the time and bandwidth constraint.
– TBR
Dec 15 '18 at 17:46
@TBR, I was actually focusing on the wrong thing. After seeking advice from my server provider it turned out the load when running one encoder was between 0.5-1.0 with my "recommended" allowance being 3.0. I did not realise how CPU intensive re-encoding actually was. I am looking into my options of optimising the ffmpeg command above if you have any suggestions.
– MrBlobby
Dec 15 '18 at 19:16