127 points · by striking · 10y ago · 60 comments
#! /bin/sh
vlc "$1"
In all seriousness though, if you are using libraries to implement almost all of the complex functionality, then the "less than 1000 lines" comment is not very relevant.The tutorial itself is solid, though it should probably mention the year of publication in the title - it was last updated in 2015, but it has been around since 2007.
And that works on all platforms, including Android and iOS, and gives you both hardware decoding and FFmpeg libavcodec software decoding. Without having the complexity (and sometimes performance issues) of GStreamer.
For MPEG-4 ASP or H.264, this is usually decoded by the hardware or the OS. For some other codecs, notably Dolby and DTS, it's more tricky.
Additionally, current OSes make it really hard, if not impossible, to get down to this level of bare hardware. There's many layers on top that you're forced to go through, closed graphics command stream, closed graphics driver, closed kernel, closed userspace libraries, and the hardware is much more complex. Really DirectX does serve as the lowest level standard way on Windows to access graphics card hardware.
Do you really think those DirectX libraries have music players, graphics assets (so that you don't need to procedurally generate all) and other components that intros/demos need?
Writing 4k demos is anything but trivial. It's in no way comparable to video player situation.
But all developers still have the same size limit and access to the same apis. Which means that creative competition is totally possible.
But sure, comparing between 4k demos is possible, but as DirectX evolves the comparison becomes unfair, since the system libraries add more functionalities over time.
"Write your own video player with SDL and ffmpeg!"
Or something along those lines, anyway.
I would change it, but the post got revived from yesterday, so the edit button's gone.
Is it really that bad a title, though? Few people actually write their own video decoder or display code anymore...
While SDL has pretty good docs, FFMPEG(the library, not the command line tool) has terrible one.
This is probably the best source of information about FFMPEG(beside the actual code).
IIRC, I also don't think their mapping from SDL audio channels to ffmpeg channels is surjective (to say nothing of planar/non-planar audio).
I would suggest reading the ffplay.c example code.
Complete disappointment -- I learn nothing.
Their license is DRACONIAN, and they are nasty about enforcing it.
Their legal page even suggests (or should I say, demands) additional provisions above and beyond what the LGPL asks for (i.e. "There are also a few items that are not really related to LGPL compliance but are good ideas anyway"):
https://www.ffmpeg.org/legal.html
If they catch you violating their LGPL license, they act very antagonistically to you -- as in, they are completely unwilling to work with you by taking the hard line stance that the only way you can appease them and comply with their license is to release your source code.
They even once had a Hall of Shame where they publicly called out offenders: https://www.reddit.com/comments/9e25a/hall_of_shame_a_list_o...
LGPL means no static linking, so using ffmpeg in your closed source Android/iOS apps is already completely ruled out of the picture.
I mean, it's well within their rights to impose whatever license they want on their software, but you shouldn't think that using ffmpeg in any closed source or commercial software is a good idea.
EDIT: I think it's worth mentioning that none of this comes from personal experience. :)
In MediaCoder's case, the nastiness ensued because the author didn't distribute the source code with the ffmpeg binaries that he included with his software.
LGPL v3 even relaxes that particular clause at issue by adding:
"If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code."
Meanwhile, the ffmpeg authors bull-headedly refused to mention to the MC developer what term he was violating, and other ffmpeg mailing list users were equally as puzzled as the MC developer.
I might add that the MC developer submitted patches with contributions to ffmpeg, all of which were refused without cause by the ffmpeg team.
This kind of treatment seems pretty tight-wad, wouldn't you say so?
The license is not draconian in the usual sense of the word. The requirements of the LGPL are modest (frankly they require you to grant end users just about the minimum rights that users should always get for any library that was used in a program, IMO), and the license is well known and well understood.
> Their legal page even suggests (or should I say, demands) additional provisions above and beyond what the LGPL asks for (i.e. "There are also a few items that are not really related to LGPL compliance but are good ideas anyway"):
They explicitly say "It is not the only way to comply with the license, but we think it is the easiest."
> If they catch you violating their LGPL license, they act very antagonistically to you -- as in, they are completely unwilling to work with you by taking the hard line stance that the only way you can appease them and comply with their license is to release your source code. > They even once had a Hall of Shame where they publicly called out offenders: https://www.reddit.com/comments/9e25a/hall_of_shame_a_list_o....
You're talking about using stuff in closed source or commercial software? Do you imagine a commercial company who you licensed a library from and then proceeded to violate that license would be friendlier than that? Never mind hall of shame, you'll be looking at demands for thousands of dollars. They could be nicer about it but if they believe closed source software is inherently harmful to its users I can understand their position, and it's not their job to give you free legal advice.
> LGPL means no static linking, so using ffmpeg in your closed source Android/iOS apps is already completely ruled out of the picture.
I've used android apps that use it by allowing you to place the ffmpeg DLL in their folder. It's more work (which is a problem with Android that should be improved on) but it's the only way I can see to make sure that end users don't get stuck with an old version. For exceedingly complex C code like video codecs, security flaws are basically guaranteed (and sadly for the moment C seems to be regarded necessary for performance - I've seen some OCaml/Haskell video codecs but nothing like the wide format support of ffmpeg), and video players are often used on untrusted files from the internet. So if you were ever to stop developing your app - or even if the play store refused updates for whatever means - it's absolutely vital to your end users' security that they be able to upgrade the version of ffmpeg that the app uses, and this kind of license is the only way to enforce that.
That's a ridiculously user hostile behaviour.
The fact that android doesn't offer any native way to have apps depend on dynamic libraries is ridiculously user hostile on its part.
They are pretending they are free software but they are not. They pretend they are non profit but use scare tactics like commercial companies. Seriously its one thing to contribute for public good and another thing to restrict its usage. I am sorry but no matter how many times GPL envenglists redefine "free", its not.