Commit Graph

284 Commits

Author SHA1 Message Date
Moritz Bunkus
c2cc3a788a MPEG TS reader: force AAC framer's multiplex mode to the detected mode
During file type detection the MPEG TS reader uses the AAC parser to
detect the multiplex mode. Later on it creates the AAC framer which in
turn contains its own instance of an AAC parser. This new instance
does its own multiplex mode detection.

For LOAS/LATM the detection can only succeed if the program mux
configuration is found. If it is not part of the first first PES
packet, then the framer's instance may get the detection wrong: it
does find LOAS/LATM headers, but as the program mux configuration
hasn't been parsed yet it'll continue detection and often happen over
ADTS headers instead.

The second detection is not only harmful, it's also superfluous as the
result is already known to the upper layer (the MPEG TS
reader). Therefore pass that information through from the reader via
the framer to the framer's parser.

Fixes #1957.
2017-04-24 17:03:24 +02:00
Moritz Bunkus
e5a9a8e7f7 HEVC parser: don't parse bitstream restriction twice if timing info is present in VUI
In order to fix #1924, I added bitstream restriction handling code in
the VUI parser in commit 2a385ab1ec.
Unfortunately I didn't realize that the code was present but in the
wrong place. It was only called if timing information was present,
too.

The result of commit 2a385ab1ec was that
the bitstream restriction was now handled twice if timing information
was present.

The superfluous and wrongfully-placed copy has been removed. This
fixes #1924 properly. It also fixes #1958.
2017-04-23 19:17:37 +02:00
Moritz Bunkus
7106365899 GUI: job actions: fix default audio file name on Windows
In release the default "play audio file" action added contains the
wrong path. Sound files are actually installed in
<MTX_INSTALLATION_DIRECTORY>\data\sounds\… and the configuration added
contains <MTX_INSTALLATION_DIRECTORY>\sounds\…

The default has been fixed, and existing configurations will be
updated to the new path if they match the default, incorrect one.

Fixes #1956.
2017-04-23 11:10:12 +02:00
Moritz Bunkus
2a7be92d67 GUI: job actions: don't clear audio file name when canceling the file dialog 2017-04-23 11:10:12 +02:00
Moritz Bunkus
5fcef824be NEWS.md: fix version number 2017-04-22 19:08:08 +02:00
Moritz Bunkus
8e77593ecb bump version number, set release code name 2017-04-22 17:08:28 +02:00
Moritz Bunkus
265e2c5645 NEWS.md: update for #1804 2017-04-22 17:03:32 +02:00
Moritz Bunkus
dd226482d1 NEWS.md: re-order/re-file entries to make them easier to digest 2017-04-22 16:46:13 +02:00
Moritz Bunkus
299a3220da HEVC parser: remove all trailing zero bytes from NALUs
Fixes the HEVC-specific part of #1952.
2017-04-22 16:43:23 +02:00
Moritz Bunkus
c30d3be97e AVC parser: remove all trailing zero bytes from NALUs
Fixes the AVC-specific part of #1952.
2017-04-22 16:37:28 +02:00
Moritz Bunkus
c0d0d2f63d NEWS: add note about Qt5Multimedia 2017-04-22 13:51:07 +02:00
Moritz Bunkus
1522515133 GUI: mux: new action after starting/adding to job queue: "close current settings" 2017-04-21 19:50:51 +02:00
Moritz Bunkus
7a37903625 GUI: mux: show command line: don't include mkvmerge's location for option files
Fixes #1949.
2017-04-21 19:35:44 +02:00
Moritz Bunkus
a90d14cd8e GUIs: rename .desktop files to adhere to FreeDesktop.org standards
This allows Wayland compositors to associate the correct icons with
the running applications, e.g. for task switchers. Fixes #1948.
2017-04-19 16:10:08 +02:00
Moritz Bunkus
5e48f483b0 AVC parser: use 25 FPS instead of bogus timing info values from SPS
Fixes #1946.
2017-04-17 20:32:45 +02:00
Moritz Bunkus
21eb1ecd5b mkvmerge: don't try to relocate written data when discarding
relocate_written_data is called in the following situation:

* track headers need to be re-written
* at least one frame has been written already
* the space left right after the track headers does not suffice to
  expand the track headers

In such a case all frames that have been written already will be
moved.

However, in certain split modes then current file may actually be a
null I/O, meaning that the current output is discarded. A null I/O
object doesn't return anything when reading for it, causing an endless
loop in the relocation code which calls `read` as often as needed
until everything's been read — which can never happen with a null I/O
object.

However, it makes no sense to try to actually read the data in such a
case, as it will be discarded anyway. Therefore just avoid trying to
read the data in the first place.

Fixes #1944.
2017-04-16 07:35:25 +02:00
Moritz Bunkus
e2a10ac071 FLAC reader: handle "picture" metadata blocks as attachments
Implements #1942.
2017-04-15 18:48:03 +02:00
Moritz Bunkus
c294f0b02b AAC ADTS parser: require number of data bytes to be > 0
Fixes #1941.
2017-04-14 15:00:29 +02:00
Moritz Bunkus
5fbcd0aa67 MPEG TS reader: require five consecutive, identical AAC headers for track type detection
Using only a single one may lead to false positives and consequently
to wrong track parameters, especially if the file was cut at an
arbitrary position.

Fixes the audio-related part of #1938.
2017-04-12 22:57:22 +02:00
Moritz Bunkus
0a4c292858 HEVC parser: don't assume all parameter set arrays are present & in certain order
This was noticed during the bug fixing of #1938.
2017-04-12 22:56:52 +02:00
Moritz Bunkus
44de7c3885 HEVC parser: don't store superfluous bytes at the end of the HEVCC
The old calculation method assumed that all picture set arrays are
always present in the HEVCC. This is not the case: arrays without
picture sets should not be written. Therefore their fixed size
overhead must not be added to the expected list size.

In order not to have to calculate the size in advance, the code has
been changed to write to an auto-resizing instance of mm_mem_io_c.

This is another fix for the video-related part of #1938.
2017-04-12 22:55:08 +02:00
Moritz Bunkus
c76e83ff83 HEVC parser: fix calculation of number of parameter set arrays in HEVCC
The number of parameter set arrays is not the sum of the number of
VPS, SPS, PPS and SEI NALUs, but the number of different types. For
example, if there's one VPS, one SPS, two PPS and no SEI NALUs, the
number of parameter set arrays must be three and not four.

Fixes the video-related part of #1938.
2017-04-12 18:34:57 +02:00
Moritz Bunkus
a8f880b216 GUI: add separate actions for hibernation/sleeping instead of just suspending 2017-04-06 18:35:38 +02:00
Moritz Bunkus
2bc0c01bec NEWS.md: update 2017-04-06 12:35:13 +02:00
Moritz Bunkus
ad15fc553d GUI: watch jobs: execute actions once when job or queue finishes 2017-04-04 19:26:54 +02:00
Moritz Bunkus
49a25e25be GUI: header editor: track empty track language elements as "und"
See #1929.
2017-04-04 19:25:16 +02:00
Moritz Bunkus
955eae59bf Matroska reader: treat invalid language elements as "und"
See #1929.
2017-04-04 19:18:43 +02:00
Moritz Bunkus
43f6c799db AVC/h.264 (framed) output: honor forced default duration signaling interlaced content
Internally the default duration given on the command line is stored as
the duration of a progressive frames. Additionally the framed
AVC/h.264 output module doesn't actually check whether or not the
current block contains a frame or a field. This combination leads to
the situation that specifying a default duration that signals
interlacing (e.g. 50i) results in an actual default duration of 40ms,
that of a progressive frame.

This change passes the information provided by the user about frame
vs. fields from the command line through to the output module so that
it can react accordingly.

Fixes #1916.
2017-03-31 16:50:42 +02:00
Moritz Bunkus
668c9356aa Rakefile: re-add USER_CXXFLAGS
It was accidentally removed in d7b691b6f5.

Fixes #1925.
2017-03-31 09:07:22 +02:00
Moritz Bunkus
2a385ab1ec HEVC parser: copy bitstream restriction info in VUI parameters
The VUI parameter copy method was simply missing the code for copying
the "bitstream_restriction_flag" and all of its dependant
fields (see ITU-T "H.265 12/2016" annex E.2.1).

Fixes #1924.
2017-03-30 20:10:57 +02:00
Moritz Bunkus
3ed2556107 NEWS.md: fix typo 2017-03-30 19:09:49 +02:00
Moritz Bunkus
1752969589 configure: use AC_CHECK_TOOL for strings
Fixes #1923.
2017-03-27 19:27:00 +02:00
Moritz Bunkus
21f77bd598 Bump version number, set release code name 2017-03-25 13:47:21 +01:00
Moritz Bunkus
954caf782a mkvextract: SSA/ASS: follow given "Format" line
Before this commit mkvextract used to assume that the "Format" line
always contained all known fields. For files where this wasn't the
case the text was then empty as mkvextract was assuming that there are
more fields present than there actually were.

This commit changes mkvextract to simply follow the given field order
from an existing "Format" line.

Fixes #1913.
2017-03-20 14:11:26 +01:00
Moritz Bunkus
639407f580 HEVC parser: detect and ignore invalid default display window VUI parameters
Certain files seem to lack the "default display window" data (well,
the flag that signals its presence/absence). Therefore a
standards-compliant parser would try to read that flag, but the data
read would belong to another flag (the "vui_timing_info_present_flag").

ffmpeg has a heuristic in place for detecting such invalid default
display window parameters. This commit implements the same heuristic
in mkvmerge.

Fixes #1907.
2017-03-19 18:57:17 +01:00
Moritz Bunkus
c2672cb0b5 HEVC parser: drop all frames before the first key frame
See #1908.
2017-03-18 20:05:34 +01:00
Moritz Bunkus
7192d87d67 HEVC parser: only use last provided timestamp for a given stream position
In certain cases there are several timestamps from the source
container queued up for a given position of the NALU in the stream. In
such cases using the first available timestamp will result in
audio/video desync. Instead the last timestamp whose stream position
is smaller than or equal to the NALU's stream position should be used.

Fixes the HEVC equivalent of the problem with AVC described in #1908.
2017-03-18 19:52:47 +01:00
Moritz Bunkus
0acdc0e51c AVC parser: drop all frames before the first key frame
See #1908.
2017-03-18 18:09:11 +01:00
Moritz Bunkus
a19459a7fa AVC parser: only use last provided timestamp for a given stream position
In certain cases there are several timestamps from the source
container queued up for a given position of the NALU in the stream. In
such cases using the first available timestamp will result in
audio/video desync. Instead the last timestamp whose stream position
is smaller than or equal to the NALU's stream position should be used.

Fixes #1908.
2017-03-18 17:22:19 +01:00
Moritz Bunkus
9bd4afa777 MP3 packetizer: allow provided timestamps to go backwards
Fixes #1909.
2017-03-18 10:00:30 +01:00
Moritz Bunkus
e5b5885f37 mkvmerge: Matroska: handle timestamps < 0 properly
mkvmerge will now shift all timestamps in a file up so that no
timestamp read from the file is smaller than zero. Before this change
it was up to the output module to cope with timestamps < 0, which most
simply couldn't, and the result was audio/video desynchronization.
2017-03-08 16:42:14 +01:00
Moritz Bunkus
e11b3452a5 mkvinfo: interpret SimpleBlock::GlobalTimecode() as signed
The return value of that function is an unsigned 64bit
integer. However, Matroska files can have negative timestamps as the
relative timestamp fields in both the SimpleBlock and the BlockGroup
structures are signed. Combined with a low ClusterTimecode element
this can result in negative timestamps.
2017-03-08 16:42:14 +01:00
Moritz Bunkus
87d9363812 MP4 reader: complete rewrite of the composition time & edit list handling
The handling for edit lists ('elst' atoms) and composition timestamp
offsets ('ctts' atoms) were not working well together causing offsets
to be applied to certain track types in certain situations. This led
to offsets between tracks, e.g. when no edit lists were in play but
CTTS atoms were used.

Fixes #1889.
2017-02-24 14:15:54 +01:00
Moritz Bunkus
c2637db97c NEWS.md: fix name of configure option for DocBook XSL 2017-02-20 14:05:58 +01:00
Moritz Bunkus
881fdac870 bump version number, set release code name 2017-02-19 16:14:59 +01:00
Moritz Bunkus
594274b804 update NEWS.md 2017-02-19 13:32:36 +01:00
Moritz Bunkus
5d2f7eb039 mkvmerge: probe AC-3/MP3/AAC at start of file before in middle of file
Fixes certain misdetection scenarios.
2017-02-18 12:34:10 +01:00
Moritz Bunkus
c52e85e94c Matroska reader: DVB subtitles: add subtitling type byte if missing in CodecPrivate 2017-02-17 18:39:30 +01:00
Moritz Bunkus
41d91298cd Matroska reader: fix wrong number of arguments for format strings
Affects both the DVB subtitle and the HDMV TextST subtitle
handling. Fixes #1894.
2017-02-17 17:54:20 +01:00
Moritz Bunkus
c1213feac3 build system: try detecting pugixml via pkg-config with fallback
Implements #1891.
2017-02-13 20:47:45 +01:00
Moritz Bunkus
901aaea1e4 MP4 reader: use Boost's rational class for overflow-safe calculation
My own algorithm was producing integer overflows when compiled with gcc
6.2.0 for Windows. This resulted in negative timestamps being used and
all timestamps being shifted up by the inverse of the lowest
timestamp. For example, if the lowest timestamp after that overflow was
-00:15:00, then the very first timestamp in the file (which is usually
00:00:00) was 00:15:00.

Boost's rational class has better overflow checks and reduces values by
their greatest common divisor. Therefore they're much less likely to
occur.

Fixes #1883.
2017-02-11 14:13:30 +01:00
Moritz Bunkus
64e21468b7 GUI: run programs: add MTX_… variable for the GUI's installation directory 2017-02-10 20:58:17 +01:00
Moritz Bunkus
d4eb9938f5 mkvmerge: take split timestamp offset into account when calculating track statistics
Otherwise the parts that were skipped were not taken into account
leading to a too-high duration (and consequently to a too-low number of
bits per second in the "BPS" statistics tag).

Fixes #1885.
2017-02-10 20:56:12 +01:00
Moritz Bunkus
326d3b153a MPEG TS: accept DVBSUB tracks without finding a packet within the probe range 2017-02-07 21:53:36 +01:00
Moritz Bunkus
720956cad2 merge: h.264: add --engage for treating all I slices as key frames
Implements #1876.
2017-01-29 11:43:54 +01:00
Moritz Bunkus
0ee5ef592d MP4 reader: only parse "moov" atoms once
MP4 DASH files can contain more than one copy of the "moov"
atom. Parsing it multiple times would mean that tracks, chunk offset
tables, sample to chunk tables etc. would be filled multiple times as
well.

Commit 2b5e8c86a6 made this easier to
trigger, though the problem could have been hit with earlier code,
too. Before that commit header parsing stopped as soon as the first
"moov" and "mdat" atoms were found. Multiple "moov" atoms before the
first "mdat" atom would therefore have triggered the bug, but I'm not
aware of that having ever happened.

Fixes #1877.
2017-01-29 10:40:57 +01:00
Moritz Bunkus
f75a9c88c4 MP4 reader: always process whole key frame table
The old code used a way of iterating over the table that would get hung
up on duplicate entries. Additionally it relied on the table being
sorted in ascending order in the source file.

The result in such a case was that only key frames up to and including
the first duplicate frame index in the key frame index table were marked
as key frames in the output file, even though more key frames index
entries might exist.

The new method simply iterates over the whole table once, from start to
finish, and looks the referenced frames up properly.

This is the last part of the fix for #1867.
2017-01-27 23:29:37 +01:00
Moritz Bunkus
168afa9691 MP4 reader: only set chunks from chunk map if they're not from "trun" atoms
The chunk table can be filled via two different kinds of atoms:

• The "stco"/"co64" atoms in the normal "moov" atoms and
• the "trun" atoms in the "moof" atoms used for DASH.

The latter already know often each chunk applies: exactly
once. Therefore their "size" member is already set.

It's different for the chunks read from "stco"/"co64", though. For them
the times they apply (their "size" member) is derived from the chunk map
table. However, the chunk map table only knows a start index into the
chunk table but not an end index. Therefore the last chunk map entry is
applied from its start index until the end of the chunk table.

This overwrites the "size" member that's already set for chunks read
from "trun" atoms, though. The result is that data is read from the
wrong portion of the file.

Part of the fix for #1867.
2017-01-27 23:25:46 +01:00
Moritz Bunkus
297af47cc7 MP4 reader: parse edit lists ("edts" atoms) inside "moof" atoms, too
Edit lists don't have to be different, bu they can be. Therefore do what
ffmpeg does: parse all of them and only use the last one parsed.

Part of the fix for #1867.
2017-01-27 23:25:19 +01:00
Moritz Bunkus
2b5e8c86a6 MP4 reader: always scan for all top level atoms
The old code was trying to save time by only scanning until the first
"mdat" (the encoded data for all the frames) and first "moov" (track
headers etc.) atoms were found.

If a "moof" (for segmented headers in MP4 DASH) atom was found during
that scan, it switched to scanning all top level atoms in order to find
all other "moof" atoms.

However, there are DASH files where the first "moof" atom is located
behind the first "mdat" and "moov" atoms. Reading such a file mkvmerge
aborted its top-level atom scan before encountering the "moof" atom and
therefore never switched to DASH mode. The result was that only a small
portion of the file was read: as much as was given via the tables in the
"moov" atom.

The new code does away with that shortcut and always scans all top level
atoms. It will therefore switch to DASH mode even if the first "moof"
atom is located behind the first "mdat" and "moov" atoms.

Part of the fix for #1867.
2017-01-27 23:23:24 +01:00
Moritz Bunkus
3ceae43548 AC-3 packetizer: take stream position of provided timestamps into account
Some source files only provide one timestamp every n AC-3 frames. In
such situations the next provided timestamp might arrive before all of
the data for the previous AC-3 frame has been flushed (due to the AC-3
parser buffering data in order to determine whether or not a dependent
frame is following). The result is a single gap of one frame after frame
number n - 1.

Fixes #1864.
2017-01-27 16:07:42 +01:00
Moritz Bunkus
8a1b714c5d GUI: chapters: add default character set preference for text chapter files
Implements #1874.
2017-01-27 10:44:12 +01:00
Moritz Bunkus
8171da0a60 GUI: mux: add "character set" column to "tracks" list view
Implements #1873.
2017-01-26 21:38:53 +01:00
Moritz Bunkus
055741c806 documentation: add xsltproc, DocBook XSL, po4a
See #1865.
2017-01-25 21:19:11 +01:00
Moritz Bunkus
a83fd64217 bump version number, set release code name 2017-01-22 14:17:42 +01:00
Moritz Bunkus
63effb10ef mkvmerge: VobSub: use default index for tracks read from Matroska missing CodecPrivate
The default palette used will not look good in most of the cases, but
it's hard to guess a palette and pretty much impossible without actually
decoding a lot of the packets.

Implements #1854.
2017-01-22 11:44:30 +01:00
Moritz Bunkus
945da6cd98 MP4 reader: drop frames for which track headers don't provide timestamps
Fixes #1847.
2017-01-21 20:41:00 +01:00
Moritz Bunkus
e52f878720 build system: look for & use system-wide version of nlohmann json-cpp
If one is found, it will be used. Otherwise the included version in
lib/nlohmann-json will be used.

Implements #1858.
2017-01-20 23:07:34 +01:00
Moritz Bunkus
5fe1b0be03 GUI: only clean the cache once per version
The process can take a lot of time, therefore only do it if there's a
reasonable chance that files will have to be cleaned up — which is after
a version change.

Another piece of the fix for #1860.
2017-01-20 22:20:24 +01:00
Moritz Bunkus
830c64ee3a GUI: don't lock cache dir for whole duration of cleanup operation
With a large number of files cleaning the cache can take quite some
time. During that time file identification won't work as it tries to
acquire a lock that's already held by the cleanup process.

With this change the cleanup process will release the lock after having
processed each file allowing the identification process to obtain the
lock temporarily.

Fixes #1860.
2017-01-20 21:21:32 +01:00
Moritz Bunkus
118abf32ff NEWS.md: add entry for recent commit 2017-01-14 19:32:18 +01:00
Moritz Bunkus
4007ceed93 GUI: add several installation checks at GUI startup
Things that are checked include:

• Can the mkvmerge executable be found?
• Can the mkvmerge executable be executed?
• Is mkvmerge's version the same as the GUI's?
• Only on Windows: Does the 'magic.mgc' file exist?

All of these are causes of problems that have been reported by users
multiple times over the years.
2017-01-14 19:26:15 +01:00
Moritz Bunkus
bccaccc324 NEWS.md: document changes around rake/drake 2017-01-08 21:10:52 +01:00
Moritz Bunkus
f8c320b162 NEWS.md: fix spelling errors 2017-01-08 15:16:10 +01:00
Moritz Bunkus
731f036f21 add "qaa" and "qad" ISO 639-2 language codes
Both codes come from the range "qaa–qtz" which is "reserved for local
use". Adding all of them would blow up the list of available languages
overly much, but adding just two is quite OK. These two are often used
in France.

See #1848.
2017-01-08 15:15:02 +01:00
Moritz Bunkus
87caecc71e mkvmerge cleanup: discard write buffer content in error situations
This prevents the error message "not enough space on disk" being shown
twice.

Whenever a write fails, an exception is throw, and an appropriate error
message is shown. This is the first time.

Next mkvmerge goes into its cleanup routine. There it closes the output
file. The output file uses a write buffer implementation. Before closing
the file any outstanding buffered content is written to the disk. The
disk is still full, though, triggering another exception, and another
error message is output.

The workaround is to discard any buffered content still remaining at
cleanup time. This is safe as the output file is closed manually normal
program flow. Therefore no buffered content is lost in a successful run.

Fixes #1850.
2017-01-07 18:48:45 +01:00
Moritz Bunkus
0d43f2744b Matroska reader: keep existing codec delay track property
Fixes #1849.
2017-01-07 13:00:49 +01:00
Moritz Bunkus
dcf7b15939 mkvmerge: include codec delay in identification output as "codec_delay" 2017-01-07 12:46:08 +01:00
Moritz Bunkus
17fd1fd53c MPEG TS: workaround for subtitle timestamps differing from audio/video timestamps widely
There are MPEG TS files where subtitle packets are multiplexed with
audio and video packets properly, meaning that packets that are supposed
to be shown/played together are also stored next to each other. However,
the timestamps in the PES streams have huge differences. For example,
the first timestamps for audio and video packets are around 00:11:08.418
whereas the timestamps for corresponding subtitle packets start at
09:19:25.912.

This workaround attempts to detect such situations. In that case
mkvmerge will discard subtitle timestamps and use the most recent audio
or video timestamp instead.

Implements #1841.
2017-01-06 20:06:22 +01:00
Moritz Bunkus
e1e14ed510 FileIdentifier: fix application of track defaults & caching
Before the defaults were applied before the result was stored in the
cache. The problem with that is that changing the defaults in the
preferences did not affect cached results. Adding a file the second time
was using cache data which had the old defaults applied.

Now the defaults are applied after the result has been stored in the
cache. Upon retrieval from the cache the current defaults are applied,
too.
2017-01-02 13:20:30 +01:00
Moritz Bunkus
5f096de087 MP4: determine track parameters from bitstream for MP2 audio, too
In this case the track contains MP3 data. However, the ESDS's object
type ID field is set to 0x6b in the headers indicating MP2. Additionally
the track's fields for channels & sampling frequency are set to 0.

Fixes #1844.
2017-01-01 11:55:25 +01:00
Moritz Bunkus
f40f77895f update NEWS.md 2016-12-31 19:09:11 +01:00
Moritz Bunkus
8eec6faf0c update NEWS.md 2016-12-30 15:04:47 +01:00
Moritz Bunkus
d426b2d15f convert date-ordered ChangeLog to more user-centric NEWS.md file 2016-12-29 17:03:57 +01:00