Oleg Oshmyan [Sun, 12 Mar 2017 16:31:36 +0000 (18:31 +0200)]
Remove Fontconfig on Windows (#610)
* Remove Fontconfig on Windows
Let libass use its DirectWrite font provider backend instead of Fontconfig.
This eliminates Fontconfig's font cache generation delay that occurred
at the start of an encode after a system font was (un)installed or when
HandBrake was installed and used to burn text subtitles for the first time.
* Remove LibHB's dependency on Fontconfig when it's not used
John Stebbins [Fri, 10 Mar 2017 16:10:14 +0000 (09:10 -0700)]
x265: bump to version 2.3 (#437)
* x265: bump to version 2.2
Encoder enhancements
----------------------------------
1. Enhancements to TU selection algorithm with early-outs for improved
speed; use --limit-tu to exercise.
2. New motion search method SEA (Successive Elimination Algorithm)
supported now as –me 4
3. Bit-stream optimizations to improve fields in PPS and SPS for
bit-rate savings through --[no-]opt-qp-pps,
--[no-]opt-ref-list-length-pps, and --[no-]multi-pass-opt-rps.
4. Enabled using VBV constraints when encoding without WPP.
5. All param options dumped in SEI packet in bitstream when info
selected.
6. x265 now supports POWERPC-based systems. Several key functions also
have optimized ALTIVEC kernels.
API changes
-------------------
1. Options to disable SEI and optional-VUI messages from bitstream made
more descriptive.
2. New option --scenecut-bias to enable controlling bias to mark
scene-cuts via cli.
3. Support mono and mono16 color spaces for y4m input.
4. --min-cu-size of 64 no-longer supported for reasons of visual quality
(was crashing earlier anyways.)
5. API for CSV now expects version string for better integration of x265
into other applications.
Bug fixes
--------------
1. Several fixes to slice-based encoding.
2. --log2-max-poc-lsb‘s range limited according to HEVC spec.
3. Restrict MVs to within legal boundaries when encoding.
* x265: bump to version 2.3
Encoder enhancements
----------------------------------
1. New SSIM-based RD-cost computation for improved visual quality,
and efficiency; use --ssim-rd to exercise.
2. Multi-pass encoding can now share analysis information from prior
passes (in addition to rate-control information) to improve performance
and quality of subsequent passes; to your multi-pass command-lines that
use the --pass option, add --multi-pass-opt-distortion to share
distortion information, and --multi-pass-opt-analysis to share other
analysis information.
3. A dedicated thread pool for lookahead can now be specified with
--lookahead-threads.
4. --dynamic-rd dynamically increase analysis in areas where the bitrate
is being capped by VBV; works for both CRF and ABR encodes with VBV
settings.
5. The number of bits used to signal the delta-QP can be optimized with
the --opt-cu-delta-qp option; found to be useful in some scenarios for
lower bitrate targets.
6. Experimental feature option:–aq-motion adds new QP offsets based on
relative motion of a block with respect to the movement of the frame.
API changes
-------------------
1. Reconfigure API now supports signalling new scaling lists.
2. x265 application’s csv functionality now reports time (in milliseconds)
taken to encode each frame.
3. --strict-cbr enables stricter bitrate adherence by adding filler bits
when achieved bitrate is lower than the target; earlier, it was only
reacting when the achieved rate was higher.
4. --hdr can be used to ensure that max-cll and max-fall values are
always signaled (even if 0,0).
Bug fixes
--------------
1. Fixed incorrect HW thread counting on MacOS platform.
2. Fixed scaling lists support for 4:4:4 videos.
3. Inconsistent output fix for --opt-qp-pss by removing last slice’s
QP from cost calculation.
4. VTune profiling (enabled using ENABLE_VTUNE CMake option) now also
works with 2017 VTune builds.
sr55 [Sat, 4 Mar 2017 17:22:26 +0000 (17:22 +0000)]
WinGui: Rework of the preset system
- Better support for categories.
- Switched from a List to Treeview Control.
- Remember the expansion state of each group
- Put User Presets on top after next save.
Closes #445
cclauss [Sun, 8 Jan 2017 10:23:45 +0000 (11:23 +0100)]
configure: Modernize Python in configure.py.
file is a Python built-in (https://docs.python.org/2/library/functions.html?highlight=file#file) so it should be avoided as a variable name.
Use "with open" syntax to automate file close where possible.
os.getenv() will return None if the key is not in os.environ.
Use ternary if to simplify conditional assignment where it improves, not hinders, readability.
Strings in python are immutable and it results in:
Traceback (most recent call last):
File "make/configure.py", line 1592, in <module>
action.run()
File "make/configure.py", line 287, in run
self._action()
File "make/configure.py", line 506, in _action
self.systemf[0] = self.systemf[0].upper()
TypeError: 'str' object does not support item assignment
John Stebbins [Fri, 3 Mar 2017 21:19:36 +0000 (14:19 -0700)]
sync: fix small video dejitter error
This very small error snowballs into a crash in x264 :-p
If the amount of jitter on the first frame in the queue was small
(about 1 tick) then jitter would not be removed from that frame.
This extra tick of jitter can appear on different frames depending
on when frame arrives and how much has been queued. This very small
amount of randomness lead to problems in the VFR filter. A frame
duration difference as small as 1 tick can lead to an extra frame
getting duplicated when doing CFR. When doing 2 pass encoding, this
extra frame causes x264 to crash at the end of the 2nd pass.
John Stebbins [Fri, 24 Feb 2017 17:28:33 +0000 (10:28 -0700)]
audio_resample: fix mapping of mono to single channel (#593)
* audio_resample: fix mapping of mono to single channel
libav's mixer code can't map single channel layouts to other single
channel layouts. And we were asking it to map e.g. front left to front
center because out MONO mixdown == libav front center. So when we
request MONO and the source is any single channel, change our output
layout to match the input.
John Stebbins [Fri, 24 Feb 2017 00:39:06 +0000 (17:39 -0700)]
libav: fix latm aac decoder hang
Don't return EAGAIN from decoders.
When waiting for codec parameters, the decoder returned EAGAIN which was
meant to be interpreted as "send more data". But the new libav decoder
API changed the definition of EAGAIN to mean "send the same packet
again". So hang.
John Stebbins [Wed, 22 Feb 2017 20:33:16 +0000 (13:33 -0700)]
encx265: fix 2 pass encoding when framerate is wrong
x265 expects the framerate specified to be the same for both passes. So
we must set the same value even when we compute that the actual
framerate differs from what the file's header says.
John Stebbins [Tue, 21 Feb 2017 22:38:53 +0000 (15:38 -0700)]
libav: fix mkv seek crash
Remove hopelessly broken code that attempted to rewind the seek point to
a position in the file where subtitles in every subtitle track after
the seek time are after the computed position.
John Stebbins [Thu, 13 Oct 2016 18:18:22 +0000 (11:18 -0700)]
dvd: add widescreen vobsubs when letterbox is permitted
We were only adding subtitle tracks specifically designed for letterbox
when letterbox is permitted. We should also add the subtitle tracks
that are specifically designed for wide screen.
John Stebbins [Thu, 22 Sep 2016 18:57:56 +0000 (11:57 -0700)]
vfr: add cfr frame drop debugging logs
These logs can be enabled by uncommenting HB_DEBUG_CFR_DROPS at the top
of the file.
If you have any sources that use progressive frame upsampling that you
would like to test with this new frame drop algo, enable these debug
logs to get full details of what frames are dropped and passed.
They show which frames are dropped and the metrics that the decision to
drop is based on. They also show which frames are passed and the
cadence of passed vs. dropped frames.
John Stebbins [Wed, 21 Sep 2016 22:36:07 +0000 (15:36 -0700)]
vfr: simplify and improve CFR frame dropping algo
The new algo caches extra frames so it can select a "best" frame to drop
from a list. A metric for each buffer is calculated as it is added to
the list. The metric indicates how much the frame differes from the
previous frame. The one with the lowest metric is selected for dropping
when a drop is required.
The old algo tried to latch on to a pattern without keeping any extra
frames. When "in sync" it would drop the buffer that fit the pattern.
But this only worked for a few specific patterns I had tested with and
did not work for all possible patterns (e.g. issue 50 where 1 in 5
needed to be dropped to convert 29.97 to 23.976).
John Stebbins [Tue, 21 Feb 2017 17:51:33 +0000 (10:51 -0700)]
decavcodec: drop initial_padding audio samples
These are samples that were not in the original source and were added by
the encoder. To get a faithful reproduction of the source, they must be
dropped.
John Stebbins [Mon, 20 Feb 2017 17:49:44 +0000 (10:49 -0700)]
libav: explicitly write encoder delay and preroll to mp4
This will make it possible to read encoder delay back and drop the
samples appropriately.
Writing preroll sample group to the mp4 fixes post-processing of the
file with Apple tools. If the roll sample group is not present, Apple
tools will apply an implicit rule to remove encoder delay which results
in the delay being dropped twice.
John Stebbins [Sat, 18 Feb 2017 21:11:17 +0000 (14:11 -0700)]
sync: fix sync problem with delayed streams
If a stream is delayed by a large amount and the first timestamp from
the stream is AV_NOPTS_VALUE, sync assumed a 0 timestamp which caused
loss of sync. Drop the buffer instead.
Waterflames [Sat, 18 Feb 2017 13:11:57 +0000 (14:11 +0100)]
Enabled "Per monitor DPI awareness"
This commit adds entries to app.config and app.manifest to enable per
monitor DPI awareness in Windows 10. The application will behave as
before on platforms that do not support this.
The implementation was done using official Microsoft documentation:
https://github.com/Microsoft/WPF-Samples/tree/master/PerMonitorDPI
John Stebbins [Wed, 15 Feb 2017 22:47:49 +0000 (15:47 -0700)]
muxavformat: Inform muxer of encoder delay
initial_padding is used to inform libav muxers of initial encoder delay
duration. When set for mkv it can be used to remove the silence samples
during playback since the delay value gets stored in the mkv CodecDelay
element.
John Stebbins [Wed, 15 Feb 2017 22:43:48 +0000 (15:43 -0700)]
libav: fix mkv timestamps when initial_padding is set
initial_padding is used to inform libav muxers of initial encoder delay
duration. When set for mkv it can be used to remove the silence samples
during playback.
John Stebbins [Tue, 14 Feb 2017 23:36:07 +0000 (16:36 -0700)]
mux: revert shift timestamps by largest encoder delay
Ugh! I need a brain transplant! This would have cause a properly
functioning player to insert silence at the start of playback that
wasn't in the original source.
sr55 [Sat, 11 Feb 2017 15:11:06 +0000 (15:11 +0000)]
WinGui: Change the following libraries to use NuGet sources.
- Gong-WPF-DragDrop (Upgraded to 0.1.4.3 -> 1.1.0)
- NewtonSoft.Json (Upgraded to 7.0.0 -> 9.0.1)
- Ookii.Dialogs 1.0
- Caliburn Micro (Upgraded to 2.0.2 -> 3.0.3)
Here's a description of how mp4 timestamps work and what is going wrong
for the curious.
Terminology:
pts = presentation timestamp, when a frame is displayed
dts = decode timestamp, when a frame is decoded
cts = composition offset, pts - dts
empty edit = defines the pts of the first frame in an mp4 track
mp4 timestamps are computed from 3 primary values that are in the mp4
stream.
An "empty edit" in the track edit list
per frame duration
per frame cts
Here's where things get messy. How do you compute pts(N) and dts(N) for
some frame N from only the above 3 values in the mp4 file?
empty edit == pts(0) and is read from the mp4 file (EDTS table)
duration(N) is read from the mp4 file (STTS table)
cts(N) is read from the mp4 file (CTTS table)
We know cts(0) = pts(0) - dts(0) by definition of cts
And cts(0) and pts(0) are known since they can be read from the mp4 file
This is the step libav gets wrong!
Therefore we can compute dts(0) = pts(0) - cts(0).
libav computes dts(0) = pts(0) which shifts all frames by cts(0)
After that dts(N) = dts(0) + duration(0) + ... + duration(N-1)
And finally pts(N) = dts(N) + cts(N)
John Stebbins [Thu, 9 Feb 2017 17:23:19 +0000 (10:23 -0700)]
libhb: fix Bob + CFR Same As Source + 2 Pass encode
The bob filter predicts the resulting output framerate as 2 * input
framerate. So during 2 pass encoding, we must adjust the framerate with
the knows 1st pass values *after* any predictions made by filters.