user3777: I know that it's very hard to find out best encoding parameters for a whole video file. Wouldn't it be easier to just go through the video and find out the best parameters for different parts (or scenes).
Does it make sense or probably there is software that already allows that?

user9105: Yes, some encoders allow changing parameters (like target quality or bitrate, or psychovisual tuning options (x264's aq and psy-rd options).
x264, the stand-alone command-line frontend for the library, has a --zones parameter to give more bitrate to some parts of the video.  So you could for example reduce the quality for the credits.
The actual x264 library supports changing many parameters on the fly, but I don't know if ffmpeg has a way to specify option changes for ranges of the video.  You could get nearly the same result by segmenting your video, and encoding the different segments with different options, then combining them.
Generally nobody actually does this, because it's a HUGE amount of work, and it's really hard to know which settings are going to help just by looking at a scene.  Usually if you want more quality, you just spend more CPU time on the encode, and that improves everything across the board. (--preset veryslow).  I could imagine getting some benefit out of tweaking AQ settings, though, maybe to address banding in one scene, but changing it for other scenes where that wasn't an issue.
Still, bits are essentially never precious enough for it to be worth paying a human to save them, instead of just electricity and CPU time.  This is more of a hobby thing / thought experiment to see what different codec settings do, IMO.  Maybe when we need to stream video to / from a mars colony, bits will be that precious...

user2836: What you are describing is effectively what 2-pass VBR does for you.  It makes a first path that calculates the level of change for each particular time in the video and then uses this information to make the best possible use of the available storage space.
It is, however, entirely possible to do the process manually by doing multiple encodings with different parameters.  In fact, many formats even support having multiple encodings with different parameters within the same file.  This is how you are able to change the resolution on the fly when streaming videos on YouTube and how Netflix automatically adjusts the quality on the fly as you watch to try to avoid buffering issues.
Any professional level encoder should allow you to specify multiple formats for the file in queue and many will even let you specify multiple outputs for one instance of the file.  (For example, the render queue in After Effects allows for this.)
In general, I would recommend running a 2-pass VBR and then adjusting the keyframe and total bandwidth accordingly.  If you are using a format that works based on the motion in the scene, then generally keyframes need to be more often if the video gets lots of motion artifacts (where it diverges from where it actually should be too much in high motion).  If the video is simply too low quality and "pixelly", then the bandwidth generally needs to be raised or the keyframes lowered.

3777: <p>I know that it's very hard to find out best encoding parameters for a whole video file. Wouldn't it be easier to just go through the video and find out the best parameters for different parts (or scenes).</p>

<p>Does it make sense or probably there is software that already allows that?</p>
 9105: <p>Yes, some encoders allow changing parameters (like target quality or bitrate, or psychovisual tuning options (x264's <code>aq</code> and <code>psy-rd</code> options).</p>

<p><code>x264</code>, the stand-alone command-line frontend for the library, has a <code>--zones</code> parameter to give more bitrate to some parts of the video.  So you could for example reduce the quality for the credits.</p>

<p>The actual x264 library supports changing many parameters on the fly, but I don't know if ffmpeg has a way to specify option changes for ranges of the video.  You could get nearly the same result by segmenting your video, and encoding the different segments with different options, then combining them.</p>

<p>Generally nobody actually does this, because it's a HUGE amount of work, and it's really hard to know which settings are going to help just by looking at a scene.  Usually if you want more quality, you just spend more CPU time on the encode, and that improves everything across the board. (<code>--preset veryslow</code>).  I could imagine getting some benefit out of tweaking AQ settings, though, maybe to address banding in one scene, but changing it for other scenes where that wasn't an issue.</p>

<p>Still, bits are essentially never precious enough for it to be worth paying a human to save them, instead of just electricity and CPU time.  This is more of a hobby thing / thought experiment to see what different codec settings do, IMO.  Maybe when we need to stream video to / from a mars colony, bits will be that precious...</p>
 2836: <p>What you are describing is effectively what 2-pass VBR does for you.  It makes a first path that calculates the level of change for each particular time in the video and then uses this information to make the best possible use of the available storage space.</p>

<p>It is, however, entirely possible to do the process manually by doing multiple encodings with different parameters.  In fact, many formats even support having multiple encodings with different parameters within the same file.  This is how you are able to change the resolution on the fly when streaming videos on YouTube and how Netflix automatically adjusts the quality on the fly as you watch to try to avoid buffering issues.</p>

<p>Any professional level encoder should allow you to specify multiple formats for the file in queue and many will even let you specify multiple outputs for one instance of the file.  (For example, the render queue in After Effects allows for this.)</p>

<p>In general, I would recommend running a 2-pass VBR and then adjusting the keyframe and total bandwidth accordingly.  If you are using a format that works based on the motion in the scene, then generally keyframes need to be more often if the video gets lots of motion artifacts (where it diverges from where it actually should be too much in high motion).  If the video is simply too low quality and "pixelly", then the bandwidth generally needs to be raised or the keyframes lowered.</p>
