View Full Version : FFmpeg encoding MPEG4 vs AVC
AlexeyS
10th October 2007, 18:27
Hello guys,
I'm building website and I'd like to add user video upload feature.
Everybody suggest to use FFmpeg. I have a Linux server. Server's CPU is quiet weak, it's Celeron.
What I want to do is to encode uploaded videos to some intermediate format. I will upload those "intermediate" videos to YouTube and Google Video.
I wonder, what is better (faster, higher quality, ease of use etc) AVC or ASP? I'm thinking about something like 720x480 at 4 Mbps for intermediate format (or maybe 2 Mbps for AVC?).
Dark Shikari
10th October 2007, 18:38
Why not just upload directly to Google Video and Youtube? Their internal video conversion systems are quite versatile and handle almost any format in my experience.
akupenguin
10th October 2007, 18:59
Their internal video conversion systems are quite versatile and handle almost any format in my experience.
That's because they use ffmpeg :)
Dark Shikari
10th October 2007, 18:59
That's because they use ffmpeg :)That's what I suspected :p
AlexeyS
10th October 2007, 23:25
Why not just upload directly to Google Video and Youtube? Their internal video conversion systems are quite versatile and handle almost any format in my experience.
I can't do it, because I need to upload video both to Google Video and YouTube, but these website do not have upload feature in their API.
AlexeyS
11th October 2007, 19:38
So, what will be better ASP or AVC? :)
Dark Shikari
11th October 2007, 19:39
I can't do it, because I need to upload video both to Google Video and YouTube, but these website do not have upload feature in their API.Huh? How will you upload the AVC/ASP version if you can't upload the original version?
At least to me you're basically saying "This bridge is too small for cars, so if I paint my car yellow, I'll be able to go over it." You say the API doesn't let you upload, but how will changing the format of the video allow you to upload it if, as you said, you can't?
Inventive Software
11th October 2007, 20:47
The words "Stage 6 (http://stage6.divx.com)" spring to mind. ;)
AlexeyS
12th October 2007, 11:55
Huh? How will you upload the AVC/ASP version if you can't upload the original version?
At least to me you're basically saying "This bridge is too small for cars, so if I paint my car yellow, I'll be able to go over it." You say the API doesn't let you upload, but how will changing the format of the video allow you to upload it if, as you said, you can't?
I will upload videos manually. I can download 2-4 Mbps videos to my computer and upload them to YouTube, but I can't download and upload DV which is 25 Mbps. FFmpeg will also create watermark for me, resize original video etc.
AlexeyS
12th October 2007, 11:57
The words "Stage 6 (http://stage6.divx.com)" spring to mind. ;)
Thanks. But I don't like their service. It's buggy and need really high bandwidth connection to play videos smoothly.
burfadel
12th October 2007, 12:07
AVC is more bitrate efficient than ASP, but requires a higher CPU usage to encode and play :) (to stream it will effectively use less CPU usage due to a smaller network footprint) :)
AlexeyS
12th October 2007, 15:18
AVC is more bitrate efficient than ASP, but requires a higher CPU usage to encode and play :) (to stream it will effectively use less CPU usage due to a smaller network footprint) :)
Yes, I know, but the thing is sometimes it has MUCH higher CPU usage than ASP.
Maybe someone tried to compare quality, speed etc of ASP and ASP videos encoded with FFmpeg?
foxyshadis
12th October 2007, 15:22
You can upload low-res, low-bitrate video to stage6 that streams just fine, if you want. At least it'll work as a high-quality secondary source. The search and tagging are certainly lacking, and requiring a plugin install for just one site is certainly a mass-market dealkiller.
For an intermediate encode to youtube, you could resize to 320x240 and encode to crf 18 with any fast options you like, it'll be small and the degradation far too small compared to what youtube will do to it. You can also just encode directly to youtube within their allowed parameters and have no re-encoding done at all, possibly delivering superior quality. Plus it's only 250kbps, much faster uploading.
2 mbps AVC or 4 mbps ASP for 320x240 is pretty much overkill.
AlexeyS
12th October 2007, 18:57
You can upload low-res, low-bitrate video to stage6 that streams just fine, if you want. At least it'll work as a high-quality secondary source. The search and tagging are certainly lacking, and requiring a plugin install for just one site is certainly a mass-market dealkiller.
For an intermediate encode to youtube, you could resize to 320x240 and encode to crf 18 with any fast options you like, it'll be small and the degradation far too small compared to what youtube will do to it. You can also just encode directly to youtube within their allowed parameters and have no re-encoding done at all, possibly delivering superior quality. Plus it's only 250kbps, much faster uploading.
2 mbps AVC or 4 mbps ASP for 320x240 is pretty much overkill.
I'd like to keep originals (not originals, but high quality copies). I think in just few years we'll see a lot of services with much higher video quality than YouTube has.
foxyshadis
12th October 2007, 20:40
If you want something reasonably archive quality, just use crf 12-15. It'll come out as large as it needs to be, the size is just dependent on the video and on how slow you want the encode to go. Note dark shikari's list of quick presets if you want to aim for some sort of time/size tradeoff and aren't sure what options to use.
Queue up the h.263 flv encode first anyway, it'll be fast even for 2-pass and much quicker to upload once done, while still better than youtube's quality. Winner on all fronts.
AlexeyS
12th October 2007, 23:02
If you want something reasonably archive quality, just use crf 12-15. It'll come out as large as it needs to be, the size is just dependent on the video and on how slow you want the encode to go. Note dark shikari's list of quick presets if you want to aim for some sort of time/size tradeoff and aren't sure what options to use.
What's crf?
Queue up the h.263 flv encode first anyway, it'll be fast even for 2-pass and much quicker to upload once done, while still better than youtube's quality. Winner on all fronts.
Do you mean encode video as flash file on my server and upload flash to YouTube?
check
13th October 2007, 05:51
It's a ratecontrol method that is used instead of bitrate encoding. Just replace --bitrate & --pass with --crf
AlexeyS
13th October 2007, 10:43
It's a ratecontrol method that is used instead of bitrate encoding. Just replace --bitrate & --pass with --crf
Thanks.
What about answering my first question in this thread guys? :) Is there any comparison article with numbers, I'm talking about FFmpeg ASP vs FFmpeg AVC of course.
foxyshadis
13th October 2007, 12:02
At a high enough bitrate it doesn't matter, the matrix and various options will change the character of the encode much more than the choice of codec. You can make either smooth or grainy as you like.
And yes, encode the flash video file on your own server correctly and it won't get re-encoded by youtube anymore.
AlexeyS
13th October 2007, 16:48
At a high enough bitrate it doesn't matter, the matrix and various options will change the character of the encode much more than the choice of codec. You can make either smooth or grainy as you like.
I knows that, but the reason I ask this is I'd like to get smaller file sizes. I have a choice (something like AVC 2 Mbps VS ASP 4 Mbps), and I'd like to know which option will be better.
If there is no FFmpeg benchmarks, can you guys tell me what is the nearest analog of the FFmpeg? I mean what encoder does it use (both for AVC and ASP), so I could search for benchmarks of that encoders?
And yes, encode the flash video file on your own server correctly and it won't get re-encoded by youtube anymore.
I didn't know that. But if the limit is VP6 320x240 at 250 Kbps, I will not get much better quality, right? Or maybe there is some trick?
nm
13th October 2007, 19:58
I knows that, but the reason I ask this is I'd like to get smaller file sizes. I have a choice (something like AVC 2 Mbps VS ASP 4 Mbps), and I'd like to know which option will be better.
4 Mbps ASP is usually better than 2 Mbps AVC in every way but the size. If the choices were 2 Mbps AVC and 3 Mbps ASP, and decoding complexity is not an issue, then I'd go for AVC.
If there is no FFmpeg benchmarks, can you guys tell me what is the nearest analog of the FFmpeg? I mean what encoder does it use (both for AVC and ASP), so I could search for benchmarks of that encoders?
For AVC ffmpeg can use x264, and for ASP, XviD or ffmpeg's own ASP encoder, which is usually referred to as libavcodec or lavc (however, libavcodec also contains an MPEG-2 encoder and many others, so be careful when looking for benchmarks).
Finding benchmarks where x264 is compared against XviD should be easy,
J_Darnley
13th October 2007, 21:15
The encoder that ffmpeg uses depends on what you tell it to use with the -vcodec option. Usually it will use libavcodec unless it was compiled with the various libraries then you can use libx264 or libxvid for encoding. If you want to do some benchmarking, don't forget about the -benchmark option.
foxyshadis
13th October 2007, 23:15
I think AVC gives you a lot more flexibility, frankly, AVC can do everything ASP can do and then it can do more (except GMC), that's really the bottom line. In order to actually make it look like ASP you have to disable or change some defaults, if you want that. We aren't the ones who can tell you what your optimum speed/quality/size/character tradeoffs are going to be, though. And instead of coding to a bitrate, code to a quality level (crf) that gives you somewhere near that bitrate on average, it'll keep things more consistent and faster, too. When you start testing for a speed/quality tradeoff, since you'll have to test yourself at some point, start with these presets (http://forum.doom9.org/showpost.php?p=1051519&postcount=16).
Youtube will re-encode VP6. You must use this method (http://forum.videohelp.com/topic336882.html) or something close to it, but use <350kbps bitrate and ignore the hacking parts unless you want to try that.
AlexeyS
14th October 2007, 19:50
Youtube will re-encode VP6. You must use this method (http://forum.videohelp.com/topic336882.html) or something close to it, but use <350kbps bitrate and ignore the hacking parts unless you want to try that.
So, I can use 350 Kbps instead of YouTube's 250 Kbps (if I'm not wrong, they use 250)? That's pretty cool. Thanks.
By the way, some guys in that thread talking about 800-900 Kbps videos. :confused:
AlexeyS
14th October 2007, 20:13
Omg. These guys even upload HD video with 1500 Kbps bitrate.
I wonder does YouTube staff know about that? Can they ban for this? Or they know about it and it's ok?
Dark Shikari
14th October 2007, 20:41
Omg. These guys even upload HD video with 1500 Kbps bitrate.
I wonder does YouTube staff know about that? Can they ban for this? Or they know about it and it's ok?
I've uploaded with up to 8 megabit bitrate... the filesize is still limited to (10 minutes) * (350 kbps), so its not really particularly abusive since every video still has to be under the size limit of 25.6 megabytes.
AlexeyS
14th October 2007, 20:53
I've uploaded with up to 8 megabit bitrate... the filesize is still limited to (10 minutes) * (350 kbps), so its not really particularly abusive since every video still has to be under the size limit of 25.6 megabytes.
I see, so they shouldn't ban users right?
Could you give me link to 8000 Mbps video please. I'd really like to look at it.
I have one more question to you guys. I wonder what codes does YouTube use? Is it MPEG4 ASP?
Dark Shikari
14th October 2007, 22:24
I see, so they shouldn't ban users right?
Could you give me link to 8000 Mbps video please. I'd really like to look at it.
I have one more question to you guys. I wonder what codes does YouTube use? Is it MPEG4 ASP?Youtube uses Sorenson H.263.
8 megabits (http://youtube.com/watch?v=-23Opat5zDE).
Sagekilla
15th October 2007, 00:25
I've uploaded with up to 8 megabit bitrate... the filesize is still limited to (10 minutes) * (350 kbps), so its not really particularly abusive since every video still has to be under the size limit of 25.6 megabytes.
Isn't the size limit a bit bigger, as in 100 MB max? IIRC, you could upload a file up to 100 MB big and 10 minutes long, or the equivelant of 1365 kbps at full length, though it almost always recoded to another format.
Dark Shikari
15th October 2007, 00:32
Isn't the size limit a bit bigger, as in 100 MB max? IIRC, you could upload a file up to 100 MB big and 10 minutes long, or the equivelant of 1365 kbps at full length, though it almost always recoded to another format.I'm referring to the size limit that it won't re-encode for.
Sagekilla
15th October 2007, 03:47
I'm referring to the size limit that it won't re-encode for.
Ah, so is that how you managed to get the 720p Transformers trailer onto Youtube? Or, if it isn't, how?
Edit: Nevermind, just checked that post and understand now.
Dark Shikari
15th October 2007, 03:47
Ah, so is that how you managed to get the 720p Transformers trailer onto Youtube? Or, if it isn't, how?Using the method earlier--encode below max size, hexedit header.
AlexeyS
15th October 2007, 11:54
Youtube uses Sorenson H.263.
8 megabits (http://youtube.com/watch?v=-23Opat5zDE).
Nice. Thanks, I will try this method.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.