-
Notifications
You must be signed in to change notification settings - Fork 103
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
[BUG] Fileplay stutter [need someone with DS916+ to reproduce] #15
Comments
Hello Joeri, Thank you for your issue, I'm glad you appreciate the script 😉. Before I answer your questions, I need to give you a bit of context on how all of that works: By default, when using the legacy VideoStation (without patch), playing a video calls an embeded ffmpeg library (a library used to encode/decode/transcode and manipulate video files), which only "decodes" your video files.
I often have this bug on a DS218Play too. Because realtime transcoding is a heavy task, I assume it is because of the NAS specs, but we can investigate to check it if you want.
The "original" setting is only choosable when the embeded (default) ffmpeg is used, if it's using the SynoCommunity's ffmpeg (wrapper), it's transcoding and then it's impossible to have an "original" quality (there's a bit of quality loss when transcoding).
Yes, that is probably a bug, we need to investigate that. |
Here are the steps to get the logs:
|
Dear Alex, Thank you for the quick response and the help! Here they are: Indeed it seems something with the codec?
Well, it's called hardware transcoding for a reason. I was expecting it would do the decoding part as well in hardware. It seams that was misleading of Synology. Inside is an Intel Pentium N3710
I hope this passthrough (no transcoding) can be achieved someday.... Maybe this is a Synology thing?
I hope you can help :D |
Hey there, That "codec not found" error is an expected behavior, I need to work on that but at the moment, the patch isn't wrapping Advanced Media Extensions at all, so it can guess the codec but not decode it. The SynoCommunity ffmpeg is handling it. I would say your buffering occurs because of that: https://gist.github.com/Joeri87/51c89dacdb8d06ca320d5cd414933c22#file-ffmpeg-log-L203 because the audio in your file is not always synchronized with the video, it needs to "resync" and it's what the buffering task does. That desync could happen if you lose packets too, but in your case (and because of that Mkvmerge software), I'm pretty sure the file is having an encoding issue. About hardware transcoding, it seems like it failed to initialize:
Could you:
I don't think it will, Synology don't want to pay for the DTS license so it's not included in the embeded ffmpeg library. Also, HEVC/x265 isn't natively supported by browsers, so it need to be transcoded to at least x264. About the bug (ffmpeg process stays alive after you close the app) could you open the "Resources monitor" on DSM and give me the ffmpeg process name that is staying alive. Also try to wait for a minute to see if it gets killed later or not. |
I'm not that well educated in this matter, but I can see its missing something.
Since I saw the chips specification I think saying hardware transcoding is a lie and it can only be software decoding / hardware encoding. So then I imagine the decoding part is going very inefficient/wrong?
I'll try and look into this.
I did the and here's the output: https://gist.github.com/Joeri87/b64fb71c55db802ce68f682021b2e68f
I see
Just start the stream and stop the stream now suddenly works, but, I did some more tests and this only happens when I open the video and it autimatically goes to High-Quality and I switch it manually to low quality. Both handmaid tale and rick and morty files, both H265 files. Now it's eating CPU.... |
It's supposed to bring HEVC & cie capabilities to VideoStation / other DSM apps
@th0ma7 (sorry for the ping but you're more qualified than me for that topic), do you know if the iHD driver failing to load is a normal behavior ? |
That's a possibility. DS916 uses a braswell processor (https://github.com/SynoCommunity/spksrc/wiki/Architecture-per-Synology-model) and supported CPU starts with bradwell for iHD driver (https://github.com/intel/media-driver). With that in mind, yes, it looks unsupported. The easy fix is to rename the iHD driver file so you use the legacy vaapi driver:
Here's the output on my DS918+ using DSM-6.2.4 (apollolake CPU) before disabling iHD:
And output after:
|
It seems like this is probrably the same kind of issue, being the vaapi driver not being properly used/implemented? I'd love to try this command, but I hope I can manage to repair it when needed since i'm a noob when it comes to command line. |
Okay, now this happend: sudo /var/packages/ffmpeg/target/bin/vainfo So like both drivers are missing in the FFMPEG package?? |
It's perfect, now could you try to play your movie and redo all the following please:
|
Well, same issue... Nothing has changed when you watch it... Sill im curious if there is a driver issue? Here are the outputs |
@AlexPresso This last time, I did the script post update and it won't play eac3 files. I could get it to play simple files (mkv, etc.) but it just spins with the video red circle spinning. On the server, there isn't any ffmpeg process running nor is the any ffm*.log file in the /tmp directory. It seems like it must be launching the ffmpeg process that then dies for some reason or it isn't launching at all. Has anyone seen this recently with the new VideoStation? (I'm on DSM 7.0.1-42218). Any help is appreciated, The script I use is below: Run the below uncommented lines sequentiallyFirst STOP VideoStation packageThese are the full steps I take to get everything working on my DS1817+ (Intel Atom as well):sudo mv /var/packages/VideoStation/target/bin/ffmpeg /var/packages/VideoStation/target/bin/ffmpeg.old |
Hi @EngMarc The script/steps you are using are not working because they're not patching the files from Advanced Media Extensions. To start from a clean install of VideoStation, could you try to:
Note that: there's a known issue on x265 10bits transcoding, but I've planned to fix it later. |
Ok I looked through the 'patcher.sh' script. Seems to be the same files but could be wrong. You do have the processing of these libraries which is likely the problem. Are your library mods compatible with ffmpeg 4 and DSM 7? Also, I didn't get any 'Advanced Media Extensions' related questions on install or uninstall. I do have surveillance running and found that VideoStation calls /var/packages/CodecPack/target/bin/ffmpeg41 instead of the one under VideoStation/target/bin. I did add that to my mv and ln but still get spinning red circle. |
For the default procedure yes, but as you say, you're not patching the ffmpeg41, ffmpeg33 an ffmpeg27 from Advanced Media Extensions, which is likely to be the problem.
Advanced Media Extensions is the "public" name for Codec Pack, it may have been installed by default when you upgraded to DSM 7.
These files are only replaced on ARMv8 architectures (and for older DSM versions), your NAS will only get the "wrapper_procedure", injecting an improved version of the ffmpeg_wrapper (using SynoCommunity's ffmpeg latest version when needed). Have you tried to run the patcher ? |
Just checked and my libraries are not the same as referenced in your patcher.sh script. Here's mine: I did ln the ffmpeg41 in the CodecPack dir which didn't make any difference. As for my CodecPack, there's only this in the bin dir: Maybe I need to also link the 'ffmpeg41-for-synoface' ? |
So took a look at the ffmpeg-wrapper.sh So, are you saying now that the ONLY work around is to use the ffmpeg-wrapper.sh script to redirect the ffmpeg call? Seems the compiled ffmpeg4.1 should support all the command line options that synology used (according to Vincent). I could be wrong but trying to understand the history from and why going back to the script? |
Let's open a new issue for that as it's not related in any way with a Stutter |
ok, not sure how to do that but I'm game |
BUMP |
Unfortunately, I cannot reproduce the issue on my NAS and have no idea why it does it to you. Updating to the latest DSM version would grant you to update VideoStation to the latest version and maybe fix the problem, but it may also break some other packages (like if you're using Transmission, Bazar and this kind of packages). It's the only idea I have for the moment. |
Hi @Joeri87 Could you please try the new wrapper using the following commands and tell me if you still have the issue:
|
Hi Joeri, I pushed the fix, could you please try to run the following:
|
Dear @AlexPresso , Thank you for your update and work. Now ffmpeg33 starts but has 0% cpu en ffmpeg has 40% cpu usage. Lots of hiccups. Now its even a bit worst then last time. Here is the output ls -al /var/packages/CodecPack/target/bin ls -al /var/packages/CodecPack/target/pack/bin tail -200 ffmpeg.log [2022-06-08 19:48:20] [INFO] ========================================[start ffmpeg 4886] [2022-06-08 19:49:01] [INFO] ========================================[start ffmpeg 5332] [2022-06-08 19:50:09] [INFO] ========================================[end ffmpeg 5332] [2022-06-08 19:50:30] [INFO] ========================================[start ffmpeg 6666] head -300 ffmpeg-6666.stderr tail -100 ffmpeg-6666.stderr I hope it helps |
Yes, it does help, thanks a lot. ffmpeg33 starting and having 0% usage is a normal behavior, because of the patch, ffmpeg33 is now a script running SynoCommunity ffmpeg, so it does appear as a running process but the one consuming CPU is the sub-process (ffmpeg). could you give me the output of the following command please: |
Sure: /var/packages/ffmpeg/target/bin/vainfo |
It seems like iHD is not loaded, there's a way to enable it but I don't know if iHD is supported on your achitecture, @th0ma7 do you have an idea how we could check that ? |
It's actually quite easy, just rename
Also note that if it does work well with your CPU arch let it me know so I can enable it by default in the next |
Dear @th0ma7 and @AlexPresso . I did the command sudo mv /var/packages/ffmpeg/target/lib/iHD_drv_video.so-DISABLED /var/packages/ffmpeg/target/lib/iHD_drv_video.so We did talk about it before. It would be a pitty if HVEC is in hardware unsupported. I'ts strange since it only gives issues with this one file that has the audio codec. All other HVEC without this audio codec work just perfect... /var/packages/ffmpeg/target/bin/vainfo And after a reboot, same, it keeps the circle spinning... |
A reboot won't fix it, you need to redo the
Unfortunately I can't do more about your issue, the new wrapper now directly uses the parameters generated by VideoStation and passes it to ffmpeg. There's no args edition at all. |
@AlexPresso @th0ma7 |
Check the repo readme please |
where? |
On the project home page, also, please do not create a side discussion in this issue, create a new one if you have any question or any problem |
So I did your command. Now it works like it did before, with 40% cpu load and shorter stutters, like every 4 seconds 0,5 seconds pause. Something is up with the hardware decoder happening in software if I understand correct instead of in hardware, Not sure if it is in drivers or in the chip design. Other HVEC files works fine so far but as soons as it is this file it breaks. Although its not smooth, its a huge improvement from before! Im going to try other files later as well. /var/packages/ffmpeg/target/bin/vainfo Is it now using the old driver (i965)? What if I want to revert back to the new driver? I'm sorry. But im very bad with command line... Thanks for trying so much and fixing the script! At least a lot works and you helped a lot of people!!!! Update: Other less heavy files work fine and playback smooth! They are still decoded in software I guess with 40% cpu. |
If you mean the default driver, i965 is the default one, you already loaded it |
I'm sorry but I can't do anything about your issue, the patch seems not to be the issue |
But how to undo the: Is it? sudo mv /var/packages/ffmpeg/target/lib/iHD_drv_video.so-DISABLED /var/packages/ffmpeg/target/lib/iHD_drv_video.so |
That I understand. I'm very gratefull you are the one (not forget T0ma7 and others for indredible work to keep Synology stuff working) that was able to make it happen, make it work and use 1 single command to make it all possible for people like me!!! Do you have a donate page? |
Okay, so using the iHD driver makes it fail... So with the DS916+ the i965 driver is absolutely needed and depending on the file, the software decoding might be to heavy but it will work. I will do more tests. |
Update: Yes, disabling the iHD driver is important and the i965 driver will work fine with all my tested files. Thanks! |
@Joeri87 disabling of iHD driver (e.g. newer Intel driver) is already done by latest |
the movie (on chrome Version 103.0.5060.134 64 bits) starts full screen with no button display, it plays music 3 seconds with a black screen, and then stops |
Hi Xavier, Could you give me your VideoStation's version please ? are you also using Advanced Media Extensions ? I also need to get the output of the following command: Thank you |
Hi Alex, yes sure : here is the command result: -rwxr-xr-x 1 root root 254912 Mar 3 07:48 ffmpeg33-for-audio thanks :) |
Sorry for the late reply, I had lot of things to do these days. The good news is that Advanced Media Extensions (CodecPack) doesn't use GStreamer, so the problem isn't GStreamer. If I'm right, the logs you provided here aren't containing the full log lines (there's only the slices directory, not the HLS slice full name). Could you provide me the full logs please ? :) The problem may also be that: Is the problem only occurring with this video or also with other videos ? |
Hi Alex, I did not notice other problems with other videos |
It's strange, everything seems to work fine on ffmpeg side, could the video be the problem ? |
yes, maybe. do you have an email so I can send you the video link in pm please? |
https://gist.github.com/BenjaminPoncet/bbef9edc1d0800528813e75c1669e57e
Dear Alex,
Thanks for this amazing work but I have an issue.
My setup is:
I ran the scripts and now the video's play, but there is some issues when playing this file:
I use a Chromium 93 browser to play and have VLC player installed
This is already proof it could work and I'm happy and now hoping it's fixable :).
p.s. im a linux noob, so getting the ffmpeg logs I need more help with the exact steps... sorry....
The text was updated successfully, but these errors were encountered: