Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup script is deleting TS files and media playback is not starting #1

Closed
RTUnit opened this issue Apr 2, 2023 · 0 comments
Closed
Labels
question Further information is requested

Comments

@RTUnit
Copy link
Owner

RTUnit commented Apr 2, 2023

Problem

transcode.cleanup.log shows message:

Due to inactivity when no TS file is accessed by client for 15 > 15 seconds, restarting FFMPEG and deleting all TS files for Segment

...

Deleting /config/semaphore/5c82d7aeb611ad27bacfdba0b8dd23a7.* PID file and other resouces as no corresponding TS files exist. 31 > 30 seconds since it was last modified.

Solution

Increase timeout value for global variables in transcode.cleanup.sh script. The value is given in a number of seconds to monitor for inactivity of specific Jellyfin client.

TS_INACTIVITY_RESTART_SECONDS=120 # default value = 15
KEEP_PID_MOD_SECONDS=120 # default value = 30

The general recommendation for figuring out the right value is to slightly go beyond the time that it takes to produce TS file. You can monitor if problem repeats in upcoming days/weeks and then further increase the timeout if necessary.

Stop the Cleanup script by doing: touch $SEMAPHORE_DIR/transcode.cleanup.stop. If you do not want to create the STOP file then simply restart Jellyfin server. Then change playback position or exit and start watching media again to re-launch updated Cleanup script.

Explanation

When transcoding takes long time then TS files are created slowly. There are two monitoring processes that are related with the problem and requires to be adjusted for the performance capabilities of the server:

  • TS file inactivity
  • TS segment inactivity

TS file inactivity

Cleanup script uses global variable TS_INACTIVITY_RESTART_SECONDS to set the time for monitoring TS file inactivity. The purpose of this monitoring is to ensure that FFMPEG process is still active and it will produce TS files. If files are not produced then the Cleanup script considers that FFMPEG process has a problem and it will kill it which can result that Jellyfin will start another FFMPEG to restart producing TS files.

TS segment inactivity

The purpose of this monitoring is to release the portion of directory space that was allocated for the client (TS segment) if there are no TS files produced for this client. Cleanup script calculates space required by every client. If there is a client which does not use transcoding directory then that space can be released for other clients. Cleanup script does not know if Jellyfin will produce TS files or will direct stream, so it will await for TS files and if none are appearing by expiry of KEEP_PID_MOD_SECONDS then it will stop monitoring the particular TS segment (it will delete the Segment PID file).

@RTUnit RTUnit closed this as completed Apr 10, 2023
@RTUnit RTUnit added the question Further information is requested label Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant