News for hackers. Stuff that matters.
Re:How to Write a Video Player in Less Than 1000 Lines by tbirdz on Monday March 07, 2016 @01:20AM (#11237419)
How to write a video player in 2 lines:

    #! /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.
Re:How to Write a Video Player in Less Than 1000 Lines by sspiff on Monday March 07, 2016 @03:33AM (#11237780)
The goal of this site is to provide a tutorial on how to use ffmpeg as a library. The real title is "An ffmpeg and SDL Tutorial", and the web page title is "ffmpeg tutorial". The link was posted here with only the subtitle, to make the post more alluring or mysterious (AKA clickbait).

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.

Re:How to Write a Video Player in Less Than 1000 Lines by jbk on Monday March 07, 2016 @02:21AM (#11237578)
I know you are joking, but speaking of libraries, you can now create custom video players with libVLC in less than 100 lines, and get a lot of features in a few hundreds lines. (VLC is now based on libVLC)

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.

Re:How to Write a Video Player in Less Than 1000 Lines by winter_blue on Monday March 07, 2016 @05:19AM (#11238074)
Would you need a license for H.264 and other codecs, if you wanted to put up a fully open source MIT-licensed custom-purpose libVLC-based player that you created on the iOS, Android, Mac, et al app stores?
Re:How to Write a Video Player in Less Than 1000 Lines by jbk on Monday March 07, 2016 @07:50AM (#11238565)
First, libVLC is LGPL. But for the other part, it depends.

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.

Re:How to Write a Video Player in Less Than 1000 Lines by winter_blue on Monday March 07, 2016 @09:54AM (#11239192)
Oop, I should have been more clear -- I meant patent licenses for codecs that are still encumbered by patents.
Re:How to Write a Video Player in Less Than 1000 Lines by dexterdog on Monday March 07, 2016 @07:20AM (#11238463)
He also forgot to mention that you first have to create the universe.
Re:How to Write a Video Player in Less Than 1000 Lines by ekianjo on Monday March 07, 2016 @01:28AM (#11237444)
The problem is not limited to this article. For example in the Windows demo-scene world, it's trivial to do 4k/64k demos by using all the DirectX libraries available in the OS. So that the size of the actual demo is completely relevant since you benefit from massive system libraries.
Re:How to Write a Video Player in Less Than 1000 Lines by tbirdz on Monday March 07, 2016 @01:41AM (#11237477)
To be fair, many old school demos are calling out to specialized hardware in their demos, for example the C64 SID chip, or Amiga graphics chipset. The API for accessing this hardware is not as high-level as DirectX, but it still serves as an external library of sorts for performing graphics/audio operations. All the software-based graphics routines these demo coders created are very impressive, don't get me wrong, but in the end there's still a large part of the pipeline that the coder relies on that they did not create themselves, and isn't factored into the overall code size.

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.

Re:How to Write a Video Player in Less Than 1000 Lines by gcb0 on Monday March 07, 2016 @02:24AM (#11237586)
calling out hardware != using software libraries
Re:How to Write a Video Player in Less Than 1000 Lines by vog on Monday March 07, 2016 @02:39AM (#11237619)
It is the same issue, just moved around to a different component. In today's world, most of the time "calling out hardware" means just triggering some piece of software on a separate chip.

Nevertheless, I do think that the demo scene is impressive - for a different reason.

I believe this is not about the absolute code size, but the relative code size: Within each demo category, all demos run on almost the same hardware architecture and same software platform. Yet, some of them manage to create effects in 4k which most other programmers wouldn't manage to create in 64k.

It is not about where the limits are (4k, 64k, 32 bytes, ...), but that there are limits at all. This inspires creativity, pushing the border of what people believe is doable within these limits.

Re:How to Write a Video Player in Less Than 1000 Lines by vardump on Monday March 07, 2016 @02:54AM (#11237657)
> For example in the Windows demo-scene world, it's trivial to do 4k/64k demos by using all the DirectX libraries available in the OS

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.

Re:How to Write a Video Player in Less Than 1000 Lines by mateuszf on Monday March 07, 2016 @06:06AM (#11238231)
> The problem is not limited to this article. For example in the Windows demo-scene world, it's trivial to do 4k/64k demos by using all the DirectX libraries available in the OS. So that the size of the actual demo is completely relevant since you benefit from massive system libraries.

But all developers still have the same size limit and access to the same apis. Which means that creative competition is totally possible.

Re:How to Write a Video Player in Less Than 1000 Lines by ekianjo on Monday March 07, 2016 @09:57AM (#11239205)
Yes. But what I mean is, people look at some demos and say "wow this only fits into 4k", and they completely forget that these demos rely on hundred of Mbs of system libraries in the first place.

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.

Re:How to Write a Video Player in Less Than 1000 Lines by mateuszf on Tuesday March 08, 2016 @03:54AM (#11244180)
That's true. I still remember the times where all you had was api to set individual pixels in 64Kb memory area. Yet people were able to make nice effects even using 256 bytes of assembly code.
Re:How to Write a Video Player in Less Than 1000 Lines by rasengan on Monday March 07, 2016 @03:29AM (#11237768)
This is society that we live in. We keep building on each other's stuff and it's good. :D Let's keep moving the needle. Let's see where we end up.
Re:How to Write a Video Player in Less Than 1000 Lines by irascible on Monday March 07, 2016 @06:44AM (#11238349)
<video src="porn.mp4"/>