Answers.Body: <p>From <a href="https://ffmpeg.org/ffmpeg.html#Detailed-description" rel="nofollow">FFmpeg Documentation – Detailed Description</a>:</p>
  
  <blockquote>
    <p><code>ffmpeg</code> calls the libavformat library (containing <a href="https://ffmpeg.org/ffmpeg-formats.html#Demuxers" rel="nofollow">demuxers</a>) to
    read input files and get packets containing encoded data from them.
    When there are multiple input files, ffmpeg tries to keep them
    synchronized by tracking lowest timestamp on any active input stream.</p>
    
    <p>Encoded packets are then passed to the <a href="https://ffmpeg.org/ffmpeg-codecs.html#Decoders" rel="nofollow">decoder</a> (unless <a href="http://ffmpeg.org/ffmpeg.html#Stream-copy" rel="nofollow">stream
    copy</a> is selected for the stream). The decoder produces
    uncompressed frames (raw video/PCM audio) which can be processed
    further by <a href="http://ffmpeg.org/ffmpeg-filters.html" rel="nofollow">filtering</a>. After filtering, the frames are passed to
    the <a href="https://ffmpeg.org/ffmpeg-codecs.html#Encoders" rel="nofollow">encoder</a>, which encodes them and outputs encoded packets.
    Finally those are passed to the <a href="https://ffmpeg.org/ffmpeg-formats.html#Muxers" rel="nofollow">muxer</a>, which writes the encoded
    packets to the output file.</p>
  </blockquote>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-05T18:58:07.180Z
Answers.LastActivityDate: 2014-08-05T18:58:07.180Z
Answers.UserDisplayName: llogan
Answers.Body: <p>Yes, compositing, as it is known in the industry, involves decoding two or more assets in to video streams and them combining those streams in some way.  The end result is then saved as a new file on render.  There is some variation in when rendering is done though.  Some software can put off rendering for a while to reduce the number of re-encodes required.</p>
  
  <p>For example, if combining two layers of video in After Effects, you can embed the entire composition in to Premiere rather than re-encode the video to a lossy format.  This prevents further generations of loss without having to store the lossless render while working on the video (which would be very large).</p>
  
  <p>Alternately, lossless file formats such as TGA sequences can be used for storing the result of a render without an additional generation of loss (since the render is preserved perfectly.)</p>
  
  <p>The final render still uses the same basic process of using some blending algorithm to combine the pixel data from two or more video streams in to a single stream though and that stream eventually has to be stored again.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-24T10:34:26.730Z
Answers.Text: Here language of thank you is UPVOTING the answer.
Answers.UserDisplayName: Eftekhari
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-05T19:37:54.480Z
Answers.Text: Thanks. Are there any tools in the industry that can perform this real time for HD videos?
Answers.UserDisplayName: userDtrm
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-05T19:49:43.160Z
Answers.Text: That's called a keyer, down stream keyer or mask keyer, depending on the situation.  Often a video mixer will also have the functionality.
Answers.UserDisplayName: AJ Henderson
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-06T11:20:59.313Z
Answers.Text: Is this the way it happens for re-broadcasting streams as well. For example, lets say that you need to add a logo to a stream you get which is already encoded. In that case do we need to fully decode the stream and add the overlay, and then re-encode before transmission?. Many thanks for your help.
Answers.UserDisplayName: userDtrm
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-06T13:16:14.190Z
Answers.Text: In most cases, some stream players may support a logo layer that can be applied for viewing, but generally speaking, the stream is decoded, the alteration is made and it is re-encoded.  You can't change the content of a stream without doing a new encoding, you can only alter the length (clip the video) without re-encoding and even that has some limitations.
Answers.UserDisplayName: AJ Henderson
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-05T17:57:47.097Z
Answers.LastActivityDate: 2014-08-05T17:57:47.097Z
Answers.UserDisplayName: AJ Henderson
Body: <p>My question is related to the technicality behind video overlaying. When a 3D object or an image is added to a video sequence as an overlay to render, does ffmpeg fully decode the original sequence to a raw file, then mix the object or image to the desired position and re-encode back to the desired format?. 
  I'd like to know if this is the process followed by the industry to mix 3D objects, images or other material with generic video contents. Or is there another approach to perform this task.
  Your assistance is highly appreciated.
  Thanks.</p>
  
Tags: <editing><ffmpeg><transcoding><mixing>
Title: Transcoding during ffmpeg overlay
UserDisplayName: userDtrm
ThreadText: # Transcoding during ffmpeg overlay
  
  (Asked by: username_0 on 2014-08-05)
  
  My question is related to the technicality behind video overlaying. When a 3D object or an image is added to a video sequence as an overlay to render, does ffmpeg fully decode the original sequence to a raw file, then mix the object or image to the desired position and re-encode back to the desired format?.
  I'd like to know if this is the process followed by the industry to mix 3D objects, images or other material with generic video contents. Or is there another approach to perform this task.
  Your assistance is highly appreciated.
  Thanks.
  
  **Tags:** editing, ffmpeg, transcoding, mixing
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2014-08-05. Score: 1
  
  From [FFmpeg Documentation – Detailed Description](https://ffmpeg.org/ffmpeg.html#Detailed-description):
  
  > `ffmpeg` calls the libavformat library (containing [demuxers](https://ffmpeg.org/ffmpeg-formats.html#Demuxers)) to
  > read input files and get packets containing encoded data from them.
  > When there are multiple input files, ffmpeg tries to keep them
  > synchronized by tracking lowest timestamp on any active input stream.
  >
  > Encoded packets are then passed to the [decoder](https://ffmpeg.org/ffmpeg-codecs.html#Decoders) (unless [stream
  > copy](http://ffmpeg.org/ffmpeg.html#Stream-copy) is selected for the stream). The decoder produces
  > uncompressed frames (raw video/PCM audio) which can be processed
  > further by [filtering](http://ffmpeg.org/ffmpeg-filters.html). After filtering, the frames are passed to
  > the [encoder](https://ffmpeg.org/ffmpeg-codecs.html#Encoders), which encodes them and outputs encoded packets.
  > Finally those are passed to the [muxer](https://ffmpeg.org/ffmpeg-formats.html#Muxers), which writes the encoded
  > packets to the output file.
  
  
  ---
  
  ### Answer by username_2 on 2014-08-05. Score: 0
  
  Yes, compositing, as it is known in the industry, involves decoding two or more assets in to video streams and them combining those streams in some way. The end result is then saved as a new file on render. There is some variation in when rendering is done though. Some software can put off rendering for a while to reduce the number of re-encodes required.
  
  For example, if combining two layers of video in After Effects, you can embed the entire composition in to Premiere rather than re-encode the video to a lossy format. This prevents further generations of loss without having to store the lossless render while working on the video (which would be very large).
  
  Alternately, lossless file formats such as TGA sequences can be used for storing the result of a render without an additional generation of loss (since the render is preserved perfectly.)
  
  The final render still uses the same basic process of using some blending algorithm to combine the pixel data from two or more video streams in to a single stream though and that stream eventually has to be stored again.
  
  > **Comments:**
  > **username_0**: Thanks. Are there any tools in the industry that can perform this real time for HD videos?  
  > **username_2**: That's called a keyer, down stream keyer or mask keyer, depending on the situation.  Often a video mixer will also have the functionality.  
  > **username_0**: Is this the way it happens for re-broadcasting streams as well. For example, lets say that you need to add a logo to a stream you get which is already encoded. In that case do we need to fully decode the stream and add the overlay, and then re-encode before transmission?. Many thanks for your help.  
  > **username_2**: In most cases, some stream players may support a logo layer that can be applied for viewing, but generally speaking, the stream is decoded, the alteration is made and it is re-encoded.  You can't change the content of a stream without doing a new encoding, you can only alter the length (clip the video) without re-encoding and even that has some limitations.  
  > **username_3**: Here language of thank you is UPVOTING the answer.  
  
  ---
  
  