-3

Can someone explain what's happening in my project? Please use as much detail as possible, I just want to learn, thanks.

I have an Apache web server. It contains many videos (.mp4 .mkv which are ?containers?) Also I have asx files that point to their respective videos. I want users to stream the videos (on VLC or Windows Media Player) but right now it's really slow. I think a better understanding of codecs will help.

  • So codecs compress and decompress videos, right?
  • The decompressing happens on the client side in the media player. But where does the compressing happen?
  • Is it also in the media player?
  • Or can it be specified in the asx file?
  • Or does the video file pick which codec it uses to compress and decompress.
  • Can I chose which codec to use?
  • I know there are better codecs for certain situations than others. Can someone explain that?
  • I've seen a couple of my videos using LAV to decompress while some use H264/5 (can't remember which).
  • As for the streaming side, is there a way to say: if the network speed is slow, change the video from 1080p to 480p?
  • Are there certain settings that I should be aware of in either of my media players to help with buffering, streaming, codecs, etc?
  • Just saw in the tags at the bottom that there is a codec and transcoding. Is there a difference? Does a codec specify how transcoding happens? I realize these are a lot of questions, but if someone has answers to any of them, please let me know. Again, I'm just trying to learn

EDIT If I need to make changes in the media player, would it be better to have a media player embedded inside my web server? And ideas on how to go about that/where to start?

closed as too broad by Michael Liebman, Dr Mayhem Apr 27 '17 at 18:49

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Please break this up into separate questions. As it is, this is much too broad to get you an effective answer. – Michael Liebman Apr 20 '17 at 12:05
  • How about: What's happening in my example? Where is the codec actually doing the compressing and decompressing? – alexs973 Apr 20 '17 at 13:45
2

So codecs compress and decompress videos, right?

COmpress DECompress. Yep. Just like with text encoding, e.g. ascii or unicode, but with video you take a raster (grid of pixels) and turn that into a stream of data. Often the goal is to make the size of the data as small as possible, though sometimes it's to make sure that the pixels that are reconstructed when the file is read are exactly the same as the pixels that went in, or a combination of the two.

The decompressing happens on the client side in the media player. But where does the compressing happen? Is it also in the media player? Or can it be specified in the asx file? Or does the video file pick which codec it uses to compress and decompress.

The decompression takes place in the client, beit the browser or a media player or a plugin. The compression happens once, when you compress the video, i.e when you make the mp4, mkv etc files.

The different file types are indeed different containers, and containers can contain streams encoded in different codecs. Take an mp4 file. The video will usually be encoded in h.264 while the audio is probably aac, and there might be a subtitle stream encoded as movtext. Often container formats have the capability to hold many different codecs. The quicktime (mov) container is compatible with dozens of codecs, as is mkv.

Once a file is compressed using a certain codec you will need something that can read that codec to play it. The details of what the codec is, as well as the parameters that tell the player how to decode it are in the container. So the player will also have to know how to read the container.

The .asx file will just point to the stream, it's up to the player to decode it.

Can I chose which codec to use? I know there are better codecs for certain situations than others. Can someone explain that?

Yes, different codecs are useful for different things. If you're streaming video you'll want good quality but for the smallest possible bitrates. Often that means using a lossy compression - one where the compressed video has lost quality compared to the uncompressed original. The trick is to lose the quality in a way that it's less obvious to humans. h.264 is probably the right tool for the job, unless the patent restrictions or licensing costs are an issue.

However, if I'm rendering an intermediate file in my post production chain I want high bit depth and lossless or minimally lossy quality. I might go for lossless 12-bit 4:4:4, or compromise and use a codec like cineform or proRes, depending on my OS. While they maintain quality and dynamic range, they'd be awful codecs for streaming, lossless 12 bit 4:4:4:4 has ~2500 MB/s data rate. Other codecs are a compromise between file size and quality, others work really well at ultra-low bitrates or require less CPU, others are good because they are unencumbered by patents or licensing.

I've seen a couple of my videos using LAV to decompress while some use H264/5 (can't remember which).

LAV is a software library which is used by compression and decompression software. It is capable of reading and writing many codecs. H.264/5 are codecs.

As for the streaming side, is there a way to say: if the network speed is slow, change the video from 1080p to 480p?

yes, I think so - youtube does it, but out of my field of expertise, and probably a better question for Superuser.

Are there certain settings that I should be aware of in either of my media players to help with buffering, streaming, codecs, etc?

Not really, it's the compression side of things that you want to optimise. You need to be aware of your client's capabilities and encode with that in mind.

Just saw in the tags at the bottom that there is a codec and transcoding. Is there a difference? Does a codec specify how transcoding happens? I realize these are a lot of questions, but if someone has answers to any of them, please let me know. Again, I'm just trying to learn

Transcoding is converting from one codec to another. So say I've mastered to one of my lossless 12-bit codecs. I've now got a video file that runs into hundreds of gigs. I might want to make a copy for the internets, so I fire up my transcoding app and tell it to take the master and compress it to an mp4 file, which will take up a fraction of the space.

  • If I stream the same file from my work computer vs my home computer, the streaming is different; one streams with more lag than the other. Does this have to do with what method is being used to decompress, or does it have to do with the connection bandwidth – alexs973 Apr 20 '17 at 14:23
  • It is possible that the CPU, GPU, and RAM could have an impact on playback performance, but more likely, as you guessed, it is the bandwidth. – Michael Liebman Apr 20 '17 at 15:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.