Answers.Body: <blockquote>
    <p>So codecs compress and decompress videos, right?</p>
  </blockquote>
  
  <p>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.</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>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. </p>
  
  <p>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. </p>
  
  <p>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.</p>
  
  <p>The .asx file will just point to the stream, it's up to the player to decode it.</p>
  
  <blockquote>
    <p>Can I chose which codec to use?
    I know there are better codecs for certain situations than others. Can someone explain that?</p>
  </blockquote>
  
  <p>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. </p>
  
  <p>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.</p>
  
  <blockquote>
    <p>I've seen a couple of my videos using LAV to decompress while some use H264/5 (can't remember which).</p>
  </blockquote>
  
  <p>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.</p>
  
  <blockquote>
    <p>As for the streaming side, is there a way to say: if the network speed is slow, change the video from 1080p to 480p?</p>
  </blockquote>
  
  <p>yes, I think so - youtube does it, but out of my field of expertise, and probably a better question for Superuser.</p>
  
  <blockquote>
    <p>Are there certain settings that I should be aware of in either of my media players to help with buffering, streaming, codecs, etc?</p>
  </blockquote>
  
  <p>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.</p>
  
  <blockquote>
    <p>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</p>
  </blockquote>
  
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-20T14:23:07.480Z
Answers.Text: 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
Answers.UserDisplayName: alexs973
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-20T15:53:32.827Z
Answers.Text: 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.
Answers.UserDisplayName: Michael Liebman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-20T13:57:07.640Z
Answers.LastActivityDate: 2017-04-20T13:57:07.640Z
Answers.UserDisplayName: stib
Body: <p>Can someone explain what's happening in my project? Please use as much detail as possible, I just want to learn, thanks.</p>
  
  <p>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. </p>
  
  <ul>
  <li>So codecs compress and decompress videos, right?</li>
  <li>The decompressing happens on the client side in the media player. But where does the compressing happen? </li>
  <li>Is it also in the media player?</li>
  <li>Or can it be specified in the asx file?</li>
  <li>Or does the video file pick which codec it uses to compress and decompress.</li>
  <li>Can I chose which codec to use? </li>
  <li>I know there are better codecs for certain situations than others. Can someone explain that? </li>
  <li>I've seen a couple of my videos using LAV to decompress while some use H264/5 (can't remember which).</li>
  <li>As for the streaming side, is there a way to say: if the network speed is slow, change the video from 1080p to 480p?</li>
  <li>Are there certain settings that I should be aware of in either of my media players to help with buffering, streaming, codecs, etc? </li>
  <li>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 </li>
  </ul>
  
  <p>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? </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-04-20T12:05:19.957Z
Comments.Text: Please break this up into separate questions. As it is, this is much too broad to get you an effective answer.
Comments.UserDisplayName: Michael Liebman
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-04-20T13:45:50.577Z
Comments.Text: How about: What's happening in my example? Where is the codec actually doing the compressing and decompressing?
Comments.UserDisplayName: alexs973
Tags: <encoding><codec><compression><transcoding><decoding>
Title: Please Explain the Codecs in my Example
UserDisplayName: alexs973
ThreadText: # Please Explain the Codecs in my Example
  
  (Asked by: username_0 on 2017-04-20)
  
  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?
  
  **Tags:** encoding, codec, compression, transcoding, decoding
  
  > **Comments:**
  > **username_1**: Please break this up into separate questions. As it is, this is much too broad to get you an effective answer.  
  > **username_0**: How about: What's happening in my example? Where is the codec actually doing the compressing and decompressing?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2017-04-20. Score: 2 | Accepted answer
  
  > 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.
  
  > **Comments:**
  > **username_0**: 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  
  > **username_1**: 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.  
  
  ---
  
  