AlexPresso / VideoStation-FFMPEG-Patcher

Patcher to enable DTS, EAC3 and TrueHD transcoding support to Synology VideoStation (from DSM 6.2 to DSM 7.0 and above ; ffmpeg4, 5, 6, 7 ready)
1.06k stars 102 forks source link

[BUG] HEVC+AAC_LC and H264+EAC3 videos don't play after patching #113

Closed pedroms closed 11 months ago

pedroms commented 11 months ago

Issue report: https://gist.github.com/pedroms/79121ad8aaf5aa2abea923690ee801be

Describe the bug HEVC+AAC_LC and H264+EAC3 videos are not playing after patching.

Additional context Attempted to play through browser, iOS app, and streaming to Chromecast.

Formats that I tried and are failing to play:

Container Video codec Audio codec
mp4 hevc aac_lc
matroska,webm h264 eac3

Video that was able to play successfully:

AlexPresso commented 11 months ago

Hi @pedroms

I don't see any issue or sign that ffmpeg was running from the issue-report, did you played rhe video (and kept it playing in the background) when running the issue-report ?

Are these videos playing without the patch ?

AlexPresso commented 11 months ago

I just seen that the patch_utils.sh script was not loaded by the ffmpeg wrapper, it's required to run:

FFMPEG prev logs...................................
Cannot load patch_utils.sh

Could you please give me the output of the following commands:

pedroms commented 11 months ago

did you played rhe video (and kept it playing in the background) when running the issue-report ?

@AlexPresso yes, but it just keeps loading, showing the loading spinner.

Are these videos playing without the patch ?

Here's the result with and without the patch:

Container Video codec Audio codec Plays with patch? Plays without patch?
mp4 hevc aac_lc
matroska,webm h264 eac3
mp4 h264 aac_lc

As for checking the patch_utils.sh script, here you go:

root@:~#     ls -al /var/packages/VideoStation/patch
total 16
drwxr-xr-x 2 root root 4096 Dec 10 08:53 .
drwxr-xr-x 6 root root 4096 Dec 10 08:55 ..
-rw-r--r-- 1 root root   62 Dec 10 08:53 patch_config.sh
-rw-r--r-- 1 root root 1497 Dec 10 08:53 patch_utils.sh
root@:~#     ls -al /var/packages/CodecPack/patch
total 16
drwxr-xr-x 2 root root 4096 Dec 10 08:53 .
drwxr-xr-x 5 root root 4096 Dec 10 08:54 ..
-rw-r--r-- 1 root root   62 Dec 10 08:53 patch_config.sh
-rw-r--r-- 1 root root 1497 Dec 10 08:53 patch_utils.sh

Thank you for your time and help with this 🙇

AlexPresso commented 11 months ago

Hi @pedroms, thanks to you for the feedback :) .

I don't have this issue using DSM 7.0+ but it could be a permission issue on DMS 6.2, could you please try to run the following commands to change the permissions of the patch files in VideoStation and CodecPack:

VideoStation

chown -R root:VideoStation /var/packages/VideoStation/patch
chmod -R 755 /var/packages/VideoStation/patch

CodecPack:

chmod -R 755 /var/packages/CodecPack/patch

After changing the permissions, please try to play a video file again and after waiting maximum 1 min, if nothing plays, please run the issue-report tool again and copy paste the output; so we can check if something changed or not :)

pedroms commented 11 months ago

@AlexPresso after updating the permissions with those commands, this is the result:

root@:~#     ls -al /var/packages/VideoStation/patch
total 16
drwxr-xr-x 2 root VideoStation 4096 Dec 15 09:35 .
drwxr-xr-x 6 root root         4096 Dec 15 09:45 ..
-rwxr-xr-x 1 root VideoStation   62 Dec 15 09:35 patch_config.sh
-rwxr-xr-x 1 root VideoStation 1497 Dec 15 09:35 patch_utils.sh
root@:~#     ls -al /var/packages/CodecPack/patch
total 16
drwxr-xr-x 2 root root 4096 Dec 15 09:35 .
drwxr-xr-x 5 root root 4096 Dec 15 09:36 ..
-rwxr-xr-x 1 root root   62 Dec 15 09:35 patch_config.sh
-rwxr-xr-x 1 root root 1497 Dec 15 09:35 patch_utils.sh

I tried playing the video again (mp4, hevc, aac_lc) and it did not work 🙁 Here's the report: https://gist.github.com/pedroms/59173b5eb2eb10da2b14d2a58517e2d5

AlexPresso commented 11 months ago

@pedroms if you run the following command in your terminal, do you have any error ? source /var/packages/VideoStation/patch/patch_utils.sh ?

pedroms commented 11 months ago

@AlexPresso no error, it does not return anything:

root@:~# source /var/packages/VideoStation/patch/patch_utils.sh
root@:~# 
AlexPresso commented 11 months ago

Hi @pedroms

Thank you for the tests, I added some error logging in the following PR (#116) it's not a fix for your issue yet, just a step for me to try get more informations about your issue, would it be possible for you to try it please:

Please try to run another video file and run the issue-report script again, hopefully we can get the error thrown when the script is trying to load patch_utils.sh

pedroms commented 11 months ago

@AlexPresso followed your instructions. Here's the latest issue report: https://gist.github.com/pedroms/01f2e056d9557abdc7e26bc091c284d8

AlexPresso commented 11 months ago

Thank you for testing, that's great news we're making progress and I know how to fix it, I'll make some change in the patcher to give right permissions to the scripts, I'll get back to you when everything ready :)

AlexPresso commented 11 months ago

Could you just do this one last try before I make changes to the patcher please: chmod -R 755 /var/packages/CodecPack/target/pack/bin

And try to play a video file as is

AlexPresso commented 11 months ago

I pushed a new test wrapper in #116

You can try it out using the following:

I'm not facing the same issue on DSM 7.0+, so it's possible the setuid on the CodecPack's scripts is messing with DSM 6.2 apparmor configuration, let's try :)

pedroms commented 11 months ago

@AlexPresso thank you for your work to fix this. I followed your latest instructions and, even with the new test patch, the video fails to play 😕 Similar to the previous times, I ran the report tool while the video is trying to play: https://gist.github.com/pedroms/b5c18c64d22c0300a085fabebe4f66ce

AlexPresso commented 11 months ago

Okay, I'll remove these utils script and put everything back in the ffmpeg wrapper directly, so the script won't need to load any external file again

Sorry, it took long time but I wanted to test everything before choosing this solution

AlexPresso commented 11 months ago

Hi @pedroms

I pushed a new test wrapper in #117

You can try it out using the following:

There are no more external scripts to load so there should not be any permission issue anymore

pedroms commented 11 months ago

@AlexPresso 🎉 it's all fixed now! Here's the result with the test patch:

Container Video codec Audio codec Plays?
mp4 hevc aac_lc
matroska,webm h264 eac3
mp4 h264 aac_lc

Thank you so much for your help and for keeping this patcher alive and well. Happy holidays!

AlexPresso commented 11 months ago

You're welcome, thanks to you for testing and for your patience :)

Happy Holidays ! 🎅