user25772: I am recording a video using OBS Studio with the following settings:


With these settings, OBS is consuming 55 to 60 MB storage for a minute long recording. Considering that my recordings span across multiple hours, a 2-hour recording ends up consuming as much as 4 GB space.
So I tried to transcode the recorded videos with FFMPEG with this command:
ffmpeg.exe -i [RecordedVideoFileName.mkv] [OutputVideoFileName.mkv]
The transcoded video consumes just 5-6 MB per minute in comparison to 55-60 MB per minute as consumed by OBS. The logs of the command are here.
While going through the logs, the following statements statements caught my eye:
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> vorbis (libvorbis))

So I had the following questions:

What is the difference between h264(constrained), h264(native) and h264(libx264) encoders?
Does transcoding from one to another (as in my case) result in degraded video/audio quality?


user1871: Let me clarify what a stream mapping line such as the one below, indicates.
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))

Stream #0:0 indicates that the input stream is from the first file #0:0 and is the first stream in that file #0:0
-> #0:0 indicates that the input stream is sent to the first stream of the first output file.
h264 (native) means that the detected codec of the input stream is H.264 and that ffmpeg will use its native (builtin) decoder to decode the stream.
h264 (libx264) means that the codec of the output stream will be H.264 and that ffmpeg will use the libx264 encoder to generate this stream.
"h264(constrained)" usually seen in the input file dump e.g.
Stream #0:0: Video: h264 (Constrained Baseline), yuv420p(progressive)...

indicates that the input stream codec is H.264 and the stream profile is Constrained Baseline. A profile defines the kind of methods that an encoder can use to generate streams and also a set of methods that a decoder is expected to perform, in order to decode the stream.
With your ffmpeg command, libx264 is re-encoding your video stream with CRF 23 and profile High. If the output looks fine to you, there's nothing to do further.
To experiment, you can use
ffmpeg.exe -i [RecordedVideoFileName.mkv] -crf X [OutputVideoFileName.mkv]

where X can go from 0 to 51. 18 to 28 is a good range for good quality and file size. Lower is better quality and larger size.

25772: <p>I am recording a video using OBS Studio with the following settings:
<a href="https://i.stack.imgur.com/gosCi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gosCi.png" alt="OBS Recording Settings"></a>
<a href="https://i.stack.imgur.com/XUbaD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XUbaD.png" alt="OBS Video Settings"></a></p>

<p>With these settings, OBS is consuming 55 to 60 MB storage for a minute long recording. Considering that my recordings span across multiple hours, a 2-hour recording ends up consuming as much as 4 GB space.</p>

<p>So I tried to transcode the recorded videos with FFMPEG with this command:</p>

<p><code>ffmpeg.exe -i [RecordedVideoFileName.mkv] [OutputVideoFileName.mkv]</code></p>

<p>The transcoded video consumes just 5-6 MB per minute in comparison to 55-60 MB per minute as consumed by OBS. The logs of the command are <a href="https://pastebin.com/AuM0Fcza" rel="nofollow noreferrer">here</a>.</p>

<p>While going through the logs, the following statements statements caught my eye:</p>

<pre><code>Stream mapping:
  Stream #0:0 -&gt; #0:0 (h264 (native) -&gt; h264 (libx264))
  Stream #0:1 -&gt; #0:1 (aac (native) -&gt; vorbis (libvorbis))
</code></pre>

<p>So I had the following questions:</p>

<ol>
<li>What is the difference between h264(constrained), h264(native) and h264(libx264) encoders?</li>
<li>Does transcoding from one to another (as in my case) result in degraded video/audio quality?</li>
</ol>
 1871: <p>Let me clarify what a stream mapping line such as the one below, indicates.</p>

<pre><code>Stream #0:0 -&gt; #0:0 (h264 (native) -&gt; h264 (libx264))
</code></pre>

<p><code>Stream #0:0</code> indicates that the input stream is from the first file #<strong>0</strong>:0 and is the first stream in that file #0:<strong>0</strong></p>

<p><code>-&gt; #0:0</code> indicates that the input stream is sent to the first stream of the first output file.</p>

<p><code>h264 (native)</code> means that the detected codec of the input stream is H.264 and that ffmpeg will use its native (builtin) decoder to decode the stream.</p>

<p><code>h264 (libx264)</code> means that the codec of the output stream will be H.264 and that ffmpeg will use the <code>libx264</code> encoder to generate this stream.</p>

<p>"h264(constrained)" usually seen in the input file dump e.g.</p>

<pre><code>Stream #0:0: Video: h264 (Constrained Baseline), yuv420p(progressive)...
</code></pre>

<p>indicates that the input stream codec is H.264 and the stream <a href="https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Profiles" rel="nofollow noreferrer">profile</a> is Constrained Baseline. A profile defines the kind of methods that an encoder can use to generate streams and also a set of methods that a decoder is expected to perform, in order to decode the stream.</p>

<p>With your ffmpeg command, libx264 is re-encoding your video stream with CRF 23 and profile High. If the output looks fine to you, there's nothing to do further.</p>

<p>To experiment, you can use</p>

<pre><code>ffmpeg.exe -i [RecordedVideoFileName.mkv] -crf X [OutputVideoFileName.mkv]
</code></pre>

<p>where X can go from 0 to 51. 18 to 28 is a good range for good quality and file size. Lower is better quality and larger size.</p>
