View Issue Details

IDProjectCategoryView StatusLast Update
0005758The Dark ModGUIpublic04.01.2022 06:42
ReporterGeep Assigned Tostgatilov  
Status closedResolutionno change required 
OS Versionwin 10 
Product VersionTDM 2.09 
Summary0005758: Cutscene video shortfalls in replay & embedded audio
DescriptionThere are two problems with non-briefing (i.e., mid-game) videos, seen in 2.09 and (I think) 2.10 dev.

1) Any particular video will only play once during a FM session. Even if you do a Quicksave before the first play, and then a Quickload afterwards, the second attempt will not show the video again. This is actually the main use case, where you are trying to do a replay.

2) The wiki technique in "Cutscene video with FFmpeg", to use the audio from an mpeg video, does not seem to work for a non-briefing video. Instead, one must continue to use the more tedious method: extract audio from the .mp4 file and play it back as one or more separate audio files, with one or more appropriate sys.waits. (I've done that in the FM away0. For simplicity, the example map here does not include such extracted audio. If it were, you would hear the audio sync'd with video on the first button press, and the audio alone on the second button press.)
Steps To ReproduceThe attached map can help show these shortcomings.

1) To see the video only play once, start the FM, walk to the brass button and frob it. You will see a 5-second video (with audio not implemented). When it's done, rehighlight & refrob the brass button. This time, there will be only a black screen for 5 seconds. You can also try Quicksave/Quickload as above.

2) To attempt (unsuccessfully) the "Cutscene video with FFmpeg" method with the attached map, make these changes:

a) In materials/, add "withAudio" following the "videoMap" keyword

b) Add a sound shader sound/cutscene_video.sndshd with content:

   fromVideo video/cutscene_video // .mtr
Additional InformationTip of the hat to RC1 tester prjames, who detected (1).

Are these bugs or feature requests? You be the judge.

If there's someway to fix either of these just by tweaking the .gui file, that would be nice to know.
TagsNo tags attached.
Attached Files
mp4_bug.pk4 (492,525 bytes)


related to 0005869 resolvedstgatilov Better diagnostic for syntax errors in GUI code 




31.12.2021 17:09

reporter   ~0014623

Would be nice to know if problem (1) was seen by you in the test map I provided. And beyond that, if any insight could be gleaned into the cause or a workaround.


04.01.2022 04:34

administrator   ~0014641

Last edited: 04.01.2022 04:40

The problem is in GUI code: it is wrong.

One thing which I really hate about our GUI system: it does not provide ANY diagnostics in this case!
Everything becomes totally broken, and 1) programmer can solve the problem by suffering through awful debugging on C++ side, 2) non-programmer can't do anything at all.
How many hours I have already spent in this suffering =(

I have attached the corrected GUI file.
I also had to convert the video from mpeg4 to h264 codec to make it play in 2.10.

The root problem of all evil was the semicolon after background setting.
You see: there are window parameters, they must not have semicolon, and there are commands inside script events, they must have semicolon.
This excessive semicolon broke parsing, and you did see any other errors after that.

The other issues are:
1) "nocursor 1" is window parameter, it must be outside "ontime 0".
  If it did not work for you, that's because you put it after background parameter, which broke parsing of everything that followed.
  If you want to change its value in script, you must write something like: set "nocursor" "1"
2) In order to change matcolor, you must use set command too.
  Also, you should enclose every argument of this command (name of window parameter and its value) into doublequotes.
  I'm pretty sure without doublequotes the engine will try to use individual token as argument, especially in the case of 1,1,1,1 (that's 7 tokens).
cutscene_video.gui (504 bytes)   
windowDef Desktop
  rect 0 ,0 ,640 ,480 // Standard element to define nominal grid, e.g., for placing and sizing buttons
  backcolor 1,1,1,0
  matcolor 0, 0, 0, 1
  nocursor 1

  background "video/cutscene_video"  // mp4 shader defined in materials/ file.

  onTime 0
     resetCinematics; // reset Video to start
     set "Desktop::matcolor" "1,1,1,1"; // show video
     localsound "video/cutscene_video"; // shader as defined in sound/cutscene_video.sndshd
cutscene_video.gui (504 bytes)   

Issue History

Date Modified Username Field Change
19.09.2021 01:16 Geep New Issue
19.09.2021 01:16 Geep File Added: mp4_bug.pk4
31.12.2021 17:09 Geep Note Added: 0014623
04.01.2022 04:34 stgatilov Note Added: 0014641
04.01.2022 04:34 stgatilov File Added: cutscene_video.gui
04.01.2022 04:40 stgatilov Note Edited: 0014641
04.01.2022 06:42 stgatilov Relationship added related to 0005869
04.01.2022 06:42 stgatilov Assigned To => stgatilov
04.01.2022 06:42 stgatilov Status new => closed
04.01.2022 06:42 stgatilov Resolution open => no change required