download mp4 file or execute javascript?

20 replies [Last post]
GrevenGull
Offline
Joined: 12/18/2017

Say I want to watch a film on Youtube.

I can either just watch it on youtube and execute the javascript, or I can use avideo to download the file.

Quite often (I am not certain whether this is all the time or just often) the file downloaded is mp4 file, which proprietary format.

What could be considered "having the less amount of proprietary code in your system" of downloading an mp4 file or executing javascript on youtube.com?

jxself
Offline
Joined: 09/13/2010

"mp4 file, which proprietary format"

This confuses copyright and patents, which are entirely different issues.

And don't forget that "mp4" is just a container. Think of a box. Inside the box you will find audio and/or video codecs (and maybe even subtitle codecs.) You can find H.264, MPEG-4, MP3, and more inside a file ending with .mp4 so it's best to not generalize about it and think of .mp4 as a codec in itself. Consider each of the cases differently depending on what is inside the box. The patents on MP3 audio for example have expired.

"What could be considered "having the less amount of proprietary code in your system" of downloading an mp4 file or executing javascript on youtube.com?"

Downloading the file would be, obviously. The video is data, not a program. Even though patents might exist (depending on what sort of stuff is inside the file) there are free programs to play it and you'd don't need any proprietary software for the data within.

GrevenGull
Offline
Joined: 12/18/2017

I'm not sure I really understand the file format subject.

Or.. I am sure I don't understand it :P

I should read up about it, anyway thank you for your time:)

SuperTramp83

I am a translator!

Offline
Joined: 10/31/2014

>The video is data, not a program

exactlyssimo

onpon4
Offline
Joined: 05/30/2012

To add on to what jxself said, that poprietary JavaScript code plays the same h.264/AAC video in an MP4 container. So how can using a patent-encumbered format with proprietary software be better than using it with libre software?

GrevenGull
Offline
Joined: 12/18/2017

Maybe these types of tings are obvious to you, but they are not certainly not obvious to me. I still find it difficult to understand, so I should probably read up on how all this works.

GNUser
Offline
Joined: 07/17/2013

Well to be fair you can download youtube videos in WebM format, which is non-patented and therefore you can play it without issues. But for compatibility reasons you might prefer to go with mp4 (many players allow only to play h264/mp4 and not WebM.
Anyway, it's better (freedom wise) to download the file yes.

GrevenGull
Offline
Joined: 12/18/2017

When I do $ avideo *insert URL here*

The file I end up with is "random", how do I specify what format the file will be? $ avideo -ogg *insert URL here* or something like that?

GNUser
Offline
Joined: 07/17/2013

Dunno, never used avideo. I just meant that youtube has the option of WebM, so one can use a non-patented format. Maybe someone else will be able to help with avideo. Or just read the man.

GrevenGull
Offline
Joined: 12/18/2017

> I just meant that youtube has the option of WebM,

What do you mean?

chaosmonk

I am a member!

I am a translator!

Offline
Joined: 07/07/2017

If there are multiple formats available, avideo will default to selecting the highest-quality one. You can specify .ogg with

$ avideo -f ogg [url]

but the file will not necessarily be available in a given format.

However, you can always just convert a file into another format. dir2ogg is a good tool for batch conversion of mp3 files to ogg vorbis files. For video, you could try ffmpeg or handbrake.

GrevenGull
Offline
Joined: 12/18/2017

But is it possible to convert it before it is downloaded? As to minimize the "amount of proprietary code in my system"?

chaosmonk

I am a member!

I am a translator!

Offline
Joined: 07/07/2017

> But is it possible to convert it before it is downloaded?

Perhaps by "downloaded" you mean "saved to disc." It's a common misconception that something has not yet been "downloaded" until it is saved to disc. Anything you access on your computer from the Internet is downloaded. Whether it is saved to disc or kept in RAM, it is "in your system."

So to answer your question, in order for it to be converted before you download it, it would have to happen on the server side, and this would be SaaSS.

https://www.gnu.org/philosophy/who-does-that-server-really-serve.html

GrevenGull
Offline
Joined: 12/18/2017

so when use searx.me and search for videos and then do $ avideo -F *insert URL here* I have already "downloaded all the different files so I might as well save them to disk also?

chaosmonk

I am a member!

I am a translator!

Offline
Joined: 07/07/2017

Not exactly. Running avideo with the -F option checks to see in which formats the video is available, it does not download any of the files themselves. However, if the only available formats are proprietary, the only way to convert them to another format is to first download them. There are two ways to do this:

(1) avideo downloads the file, keeps it in RAM while it converts it to another format, and saves the new file to disk, and deletes both the new file and original file from RAM.

(2) avideo downloads the file, saves it to disk, deletes it from RAM, and then you use another program like ffmpeg to convert the file to another format and delete the original.

Freedom-wise, there is no difference between these approaches. Either way, you are downloading a file in a proprietary format, converting it to a libre format, and deleting the proprietary one.

Note that a video is data, not software. You don't install or execute it. As long as you don't use proprietary software to play or convert the video, I don't see this as a software freedom issue.

GrevenGull
Offline
Joined: 12/18/2017

Cool thanks for explaining! :)

jxself
Offline
Joined: 09/13/2010

"Ogg" is nothing more than a container format, people. Like "mp4" is too can contain any number of different codecs.
The most common video codec used with it is Theora: https://en.wikipedia.org/wiki/Theora
And Vorbis for audio: https://en.wikipedia.org/wiki/Vorbis
But it might contain Opus for audio: https://en.wikipedia.org/wiki/Opus_(audio_format) (Instead of or in addition to any of the others mentioned.)

WebM is another container format too. It might contain VP8 for video: https://en.wikipedia.org/wiki/VP8
Or VP9: https://en.wikipedia.org/wiki/VP9
Or AV1: https://en.wikipedia.org/wiki/AV1
And it might also contain Vorbis or Opus for audio.

So talking of files using only their extension (without mentioning anything about what's inside) doesn't say much.

The only royalty-free formats used on YouTube are Vorbis and Opus for audio and VP8 and VP9 and video.

I've never seen a video on YouTube that uses Theora, so what's happening if you tell avideo "-f ogg"? This seems vague to me. Is it converting them? (Which is going to take time.) And if I only download the audio part is it getting only the Vorbis? Or Opus? Since both of those can go into an Ogg file. Or is it getting something else and encoding it? This whole "-f ogg" seems vague to me.

How do you know what's available? Use the -F (capitalized) switch. For example:

$ youtube-dl -F https://www.youtube.com/watch?v=YE7VzlLtp-4
[youtube] YE7VzlLtp-4: Downloading webpage
[youtube] YE7VzlLtp-4: Downloading video info webpage
[info] Available formats for YE7VzlLtp-4:
format code extension resolution note
249 webm audio only DASH audio 67k , opus @ 50k, 3.60MiB
250 webm audio only DASH audio 85k , opus @ 70k, 4.74MiB
171 webm audio only DASH audio 125k , vorbis@128k, 7.95MiB
140 m4a audio only DASH audio 128k , m4a_dash container, mp4a.40.2@128k, 9.04MiB
251 webm audio only DASH audio 155k , opus @160k, 9.29MiB
256 m4a audio only DASH audio 195k , m4a_dash container, mp4a.40.5, 13.78MiB
258 m4a audio only DASH audio 387k , m4a_dash container, mp4a.40.2, 27.40MiB
160 mp4 256x144 144p 110k , avc1.4d400c, 24fps, video only, 4.54MiB
278 webm 256x144 144p 142k , webm container, vp9, 24fps, video only, 6.64MiB
242 webm 426x240 240p 222k , vp9, 24fps, video only, 10.42MiB
133 mp4 426x240 240p 301k , avc1.4d4015, 24fps, video only, 9.32MiB
243 webm 640x360 360p 418k , vp9, 24fps, video only, 21.53MiB
134 mp4 640x360 360p 686k , avc1.4d401e, 24fps, video only, 19.49MiB
244 webm 854x480 480p 761k , vp9, 24fps, video only, 36.00MiB
135 mp4 854x480 480p 1330k , avc1.4d401e, 24fps, video only, 36.69MiB
247 webm 1280x720 720p 1502k , vp9, 24fps, video only, 68.19MiB
136 mp4 1280x720 720p 2094k , avc1.4d401f, 24fps, video only, 64.60MiB
17 3gp 176x144 small , mp4v.20.3, mp4a.40.2@ 24k, 5.79MiB
36 3gp 320x180 small , mp4v.20.3, mp4a.40.2, 16.07MiB
18 mp4 640x360 medium , avc1.42001E, mp4a.40.2@ 96k, 40.09MiB
43 webm 640x360 medium , vp8.0, vorbis@128k, 53.16MiB
22 mp4 1280x720 hd720 , avc1.64001F, mp4a.40.2@192k (best

You'll see lots of file extensions but ignore those for the moment. Look at the "Notes" part and you'll see references to Opus, Vorbis, VP9, VP8, etc.

You can match these up by looking to the left to get a resolution and all the way to the far left to get the corresponding number and then use the -f switch (lowercase; note that this is different from earlier with uppercase -F) that was used to show available formats:

youtube-dl -f 247+251 https://www.youtube.com/watch?v=YE7VzlLtp-4

Note that I specified the video then audio and I'll get VP9 video (at 720p resolution) and Opus audio (at 160kbps) inside a WebM container file.
I could also instead use -f 43+171 and get VP8 and Vorbis inside the ***same*** WebM container file.

Different codecs. Same file extension. See what I'm saying?

These are all different codecs with different technical details so I'm not going to gloss over them by simply saying I'm getting a "WebM" file and pretending that that were to communicate all of the details of the file. Referring to files only by their extension leaves the principal questions about the file unanswered. It's like getting a package at home and, in response to a question of "what is it?" someone says "it's a brown box."

GrevenGull
Offline
Joined: 12/18/2017

hohohow!

This was the reply I was looking for that I didn't know I was looking for!

I'm gonna try this out!

So what's the better quality of Vorbis and Opus? And og VP8 and VP9? I'm guessing VP9 for the latter? :P

jxself
Offline
Joined: 09/13/2010

VP9 and Opus are newer. Opus is the successor to Vorbis. The primary goal with each was reducing bitrates, resulting in smaller files.

You can check out some samples at http://opus-codec.org/examples/

As you pick different bitrates you can see that Opus lets you get down with some pretty low bitrates while still sounding good.

For another comparison go here https://people.xiph.org/~jm/opus/opus-1.2/ and check out MP3 at 32 kb/s and then live switch over to Opus 1.2 at the same bitrate.

The state of the art has advanced since MP3 came out 20+ years ago. The standards by which some will judge bitrates (by what was needed to make MP3 sound good) don't hold here. MP3 is a dinosaur of a codec and has been surpassed by better technology. Now you can get smaller files with the same or better quality.

GrevenGull
Offline
Joined: 12/18/2017

Awesome!

chaosmonk

I am a member!

I am a translator!

Offline
Joined: 07/07/2017

> I've never seen a video on YouTube that uses Theora, so what's happening if you tell avideo "-f ogg"?

avideo will look for a file with a .ogg extension, fail to find it, and output "ERROR: requested format not available"

> And if I only download the audio part is it getting only the Vorbis? Or Opus? Since both of those can go into an Ogg file.

You're right, that is ambiguous.