View Issue Details

IDProjectCategoryView StatusLast Update
0004519The Dark ModCodingpublic23.06.2018 10:58
Reporterstgatilov Assigned Tostgatilov  
PrioritynormalSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
Product VersionSVN 
Target VersionTDM 2.06Fixed in VersionTDM 2.06 
Summary0004519: Investigate using videos of common formats (avi, mp4)
DescriptionAfter x64 branch was merged, currently FFmpeg decodes all the videos. Only ROQ format is really used now, but nothing stops us from supporting other codecs and containers.

The purpose of this issue is to check how TDM plays common video formats now, and do any related improvements.
It is also a good question if it is possible to play sound directly from the video file, but it can be moved to other issue.
Additional InformationRelated discussion on forum:
  http://forums.thedarkmod.com/topic/18820-why-roq/
TagsNo tags attached.

Relationships

related to 0004518 resolvedstgatilov Briefing video starts decoding in background 
related to 0004534 resolvedstgatilov Playing sound stream from video file 
related to 0004535 resolvedstgatilov Showing video for its full duration 
related to 0004847 resolvedstgatilov Support FFmpeg videos in testVideo command 

Activities

stgatilov

stgatilov

16.05.2017 17:18

administrator   ~0008864

In commit 6899 fixed severe stuttering on AVI with XVID content.

Before, raw PTS value from packet was used to calculate timestamp.
Unfortunately, it is not set in some common cases, that's why everyone uses function av_frame_get_best_effort_timestamp to get effective timestamp. Now we use it too =)
stgatilov

stgatilov

17.05.2017 04:14

administrator   ~0008866

I have checked following combinations on a 720 x 400 video:
  AVI + XVID
  MP4v2 + XVID
  MP4 + x264
  AVI + MPEG2
  AVI + x265 - FAIL (no codec)
All of them play well, except for the last one. It is simply not supported by FFmpeg yet.
stgatilov

stgatilov

17.05.2017 04:27

administrator   ~0008868

New issues are created for playing sound stream and using natural duration of video (see related).
duzenko

duzenko

02.06.2017 19:48

developer   ~0008881

Last edited: 02.06.2017 19:49

View 2 revisions

I changed the ffmpeg use from static link to dll (win32 only) because it adds too much to exe size. We may want to revisit this later.

stgatilov

stgatilov

13.06.2017 02:25

administrator   ~0008904

It turns out that matroska (mkv) is not a good format for current player implementation.

In a sample video I see, each sound packet contains 2048 samples, which corresponds to about 46.44 ms of time. However, all the packets in mkv has timestamps with millisecond precision - that's the limitation of format specification. That's why some sound packets have 46 ms duration, and some have 47 ms duration. Although timestamps and durations cover the whole timeline properly, they do not correctly reflect the real amount of samples encoded in them. As a result, current player has to drop or insert about 10-20 samples before each packets (jitter), which produces noticeable sound artifacts (cracks).

I think it is much easier to limit support to MP4 container than trying to support every possible issue which might happen in one format or another...
stgatilov

stgatilov

14.06.2017 02:59

administrator   ~0008912

It turned out that even MP4 format sometimes starts dropping/inserting one sample regularly. This is not noticeable for voice, but test sound sample makes it clearly noticeable.

So, I have made sound decoding resistant to timestamps jitter (up to 10 ms) in svn rev 6937. This makes it possible to play MKV files normally.
However, I still think we should advise everyone using MP4.

Issue History

Date Modified Username Field Change
02.05.2017 19:15 stgatilov New Issue
02.05.2017 19:18 stgatilov Additional Information Updated View Revisions
15.05.2017 11:13 stgatilov Assigned To => stgatilov
15.05.2017 11:13 stgatilov Status new => assigned
16.05.2017 05:33 stgatilov Relationship added related to 0004518
16.05.2017 17:18 stgatilov Note Added: 0008864
17.05.2017 04:14 stgatilov Note Added: 0008866
17.05.2017 04:23 stgatilov Relationship added related to 0004534
17.05.2017 04:25 stgatilov Relationship added related to 0004535
17.05.2017 04:27 stgatilov Note Added: 0008868
17.05.2017 04:27 stgatilov Status assigned => resolved
17.05.2017 04:27 stgatilov Fixed in Version => TDM 2.06
17.05.2017 04:27 stgatilov Resolution open => fixed
17.05.2017 04:27 stgatilov Target Version => TDM 2.06
02.06.2017 19:48 duzenko Note Added: 0008881
02.06.2017 19:49 duzenko Note Edited: 0008881 View Revisions
13.06.2017 02:25 stgatilov Note Added: 0008904
14.06.2017 02:59 stgatilov Note Added: 0008912
23.06.2018 10:58 stgatilov Relationship added related to 0004847