Transcoding during ffmpeg overlay
From FFmpeg Documentation – Detailed Description:


  ffmpeg calls the libavformat library (containing 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 (unless stream
  copy is selected for the stream). The decoder produces
  uncompressed frames (raw video/PCM audio) which can be processed
  further by filtering. After filtering, the frames are passed to
  the encoder, which encodes them and outputs encoded packets.
  Finally those are passed to the muxer, which writes the encoded
  packets to the output file.