SynoCommunity / spksrc

Cross compilation framework to create native packages for the Synology's NAS
https://synocommunity.com
Other
3.04k stars 1.23k forks source link

FFmpeg EAC3 and/or DTS support in Video Station for DSM 6.x #2952

Closed mreid-tt closed 4 years ago

mreid-tt commented 7 years ago

For new Package Requests, see the guidelines

Setup

Package Name: FFmpeg _Package Version:_3.3.3-7

_NAS Model:_DS916+ _NAS Architecture:_Intel _DSM version:_6.1.3-15152 Update 6

Expected behavior

Playback of video with Dolby tracks in DS Video work without issue

Actual behavior

Playback error "failed to play the video because the file format of the currently selected audio track is not supported" (for EAC3).

Steps to reproduce

_1._Launch DS Video _2._Select video with EAC3 audio _3._Play

Package log

Check Package Center or /usr/local/{package}/var/

n/a

Other logs (attempted a re-install)

E.g. /var/log/messages or /var/log/synopkg.log

2017/10/08 16:46:44 uninstall ffmpeg: begin to stop version 3.3.3-7
2017/10/08 16:46:45 uninstall ffmpeg 3.3.3-7 Begin start-stop-status stop
2017/10/08 16:46:45 uninstall ffmpeg 3.3.3-7 End start-stop-status stop ret=[0]
2017/10/08 16:46:45 uninstall ffmpeg 3.3.3-7 Begin unload apparmor
2017/10/08 16:46:45 uninstall ffmpeg 3.3.3-7 End unload apparmor ret=[0]
2017/10/08 16:46:45 uninstall ffmpeg: stop version 3.3.3-7 successfully, result 0
2017/10/08 16:46:45 uninstall ffmpeg 3.3.3-7 Begin preuninst
2017/10/08 16:46:45 uninstall ffmpeg 3.3.3-7 End preuninst ret=[0]
2017/10/08 16:46:45 uninstall ffmpeg 3.3.3-7 Begin /bin/rm -rf /volume1/@appstore/ffmpeg
2017/10/08 16:46:46 uninstall ffmpeg 3.3.3-7 End /bin/rm -rf /volume1/@appstore/ffmpeg ret=[0]
2017/10/08 16:46:46 uninstall ffmpeg 3.3.3-7 Begin postuninst
2017/10/08 16:46:46 uninstall ffmpeg 3.3.3-7 End postuninst ret=[0]
2017/10/08 16:46:46 uninstall ffmpeg: Uninstall 3.3.3-7 successfully
2017/10/08 16:47:21 install ffmpeg 3.3.3-7 Begin preinst
2017/10/08 16:47:21 install ffmpeg 3.3.3-7 End preinst ret=[0]
2017/10/08 16:47:21 install ffmpeg 3.3.3-7 Begin /bin/mv -f /volume1/@tmp/pkginstall/package /volume1/@appstore/ffmpeg
2017/10/08 16:47:21 install ffmpeg 3.3.3-7 End /bin/mv -f /volume1/@tmp/pkginstall/package /volume1/@appstore/ffmpeg ret=[0]
2017/10/08 16:47:21 install ffmpeg 3.3.3-7 Begin /bin/rm -rf /var/packages/ffmpeg
2017/10/08 16:47:21 install ffmpeg 3.3.3-7 End /bin/rm -rf /var/packages/ffmpeg ret=[0]
2017/10/08 16:47:22 install ffmpeg 3.3.3-7 Begin /bin/mkdir -p /var/packages/ffmpeg
2017/10/08 16:47:22 install ffmpeg 3.3.3-7 End /bin/mkdir -p /var/packages/ffmpeg ret=[0]
2017/10/08 16:47:22 install ffmpeg 3.3.3-7 Begin /bin/mv -f /volume1/@tmp/pkginstall/INFO /var/packages/ffmpeg/INFO
2017/10/08 16:47:22 install ffmpeg 3.3.3-7 End /bin/mv -f /volume1/@tmp/pkginstall/INFO /var/packages/ffmpeg/INFO ret=[0]
2017/10/08 16:47:22 install ffmpeg 3.3.3-7 Begin /bin/rm -rf /var/packages/ffmpeg/scripts
2017/10/08 16:47:22 install ffmpeg 3.3.3-7 End /bin/rm -rf /var/packages/ffmpeg/scripts ret=[0]
2017/10/08 16:47:22 install ffmpeg 3.3.3-7 Begin /bin/mv -f /volume1/@tmp/pkginstall/scripts /var/packages/ffmpeg/scripts
2017/10/08 16:47:22 install ffmpeg 3.3.3-7 End /bin/mv -f /volume1/@tmp/pkginstall/scripts /var/packages/ffmpeg/scripts ret=[0]
2017/10/08 16:47:22 install ffmpeg 3.3.3-7 Begin /bin/rm -rf /var/packages/ffmpeg/conf
2017/10/08 16:47:22 install ffmpeg 3.3.3-7 End /bin/rm -rf /var/packages/ffmpeg/conf ret=[0]
2017/10/08 16:47:22 install ffmpeg 3.3.3-7 Begin /bin/mv -f /volume1/@tmp/pkginstall/conf /var/packages/ffmpeg/conf
2017/10/08 16:47:22 install ffmpeg 3.3.3-7 End /bin/mv -f /volume1/@tmp/pkginstall/conf /var/packages/ffmpeg/conf ret=[0]
2017/10/08 16:47:22 install ffmpeg 3.3.3-7 Begin postinst
2017/10/08 16:47:22 install ffmpeg 3.3.3-7 End postinst ret=[0]
2017/10/08 16:47:24 install ffmpeg: begin to start version 3.3.3-7
2017/10/08 16:47:24 install ffmpeg 3.3.3-7 Begin pre-load apparmor
2017/10/08 16:47:24 install ffmpeg 3.3.3-7 End pre-load apparmor ret=[0]
2017/10/08 16:47:24 install ffmpeg 3.3.3-7 Begin start-stop-status start
2017/10/08 16:47:24 install ffmpeg 3.3.3-7 End start-stop-status start ret=[0]
2017/10/08 16:47:24 install ffmpeg: start version 3.3.3-7 successfully, result 0
2017/10/08 16:47:24 install ffmpeg 3.3.3-7 Begin /bin/rm -rf /volume1/@tmp/pkginstall
2017/10/08 16:47:24 install ffmpeg 3.3.3-7 End /bin/rm -rf /volume1/@tmp/pkginstall ret=[0]
2017/10/08 16:47:24 install ffmpeg 3.3.3-7 successfully
Tweaqer commented 6 years ago

I don't understand why Synology wouldn't provide additional paid packages for these codecs. This way they don't have to pay and ship the feature to enterprises/consumers that don't need it but make it available in a friendly way to those that do need/want it. I would gladly pay for a hassle free solution.

mreid-tt commented 6 years ago

Yes, it's very frustrating how they are treating with this issue. I opened another support case with them and got a lukewarm response. I don' know if we should start a campaign and start flooding them with requests to fix what they broke. Anyway, below was the ticket and response...

Problem Explanation:

Since Video Station 2.3.5-1471 I can't seem to playback media with audio using the E-AC3 codec. Some online have indicated this was as a result of licencing the codec.

Problem Reproduce Steps:

Synology generally supported open source packages but the recent change in the ffmpeg codec has broken this. I would suggest you guys consider allowing users the choice of decoder packages (much like you allow for a choice of web servers, interpreters, etc.) via some sort of selector to toggle the newly included stripped down ffmpeg codec... or you allow for a paid option (much like you do for survelliance, anti-virus and file systems). This way Synology will continue to support your community of open-source projects and customers.

Agent Response:

Sadly this is correct and not supported at this time. I appreciate your feedback and will send this feedback to our product management team for further consideration. I can't currently give a timeline for its inclusion, but you can sign up here to be notified of updates automatically by email: http://sy.to/registersynologyaccount

jbogers commented 6 years ago

The problem is that Synology can probably take no (explicit) action to resolve this issue.

On one hand they are unable to get the proper licenses. This is either because of prohibitive cost or because they simply aren't allowed to license the decoder as the NAS is not a playback device.

On the other hand they cannot make changes to explicitly allow their customers to work around the licensing restrictions. That this used to be possible by coincidence is not a 'get out of jail free card' for making changes to allow this by design.

Related to this, has anyone analysed exactly how video station is finding and loading the ffmpeg libraries (dynamically loading from explicit location, RPATH, LD_LIBRARY_PATH, etc)? Maybe there is still an option to get it to load the correct version if it can be injected in the current search path.

mreid-tt commented 6 years ago

@jbogers finding out about the architecture of Video Station would be great but I don't know how to do that. Only basic knowledge of Linux unfortunately. Anyone have any ideas of how to approach this?

dhayab commented 6 years ago

@houndtt you can check the content of the Video Station app in /volume1/@appstore/Video Station. Video Station includes it's own ffmpeg binary, but it did nothing when I replaced it with a link to one that doesn't disable eac3. I suppose that on top of the ffmpeg version, the app has its own checks to prevent loading an unsupported video.

techbliss commented 6 years ago

The build prefix they used to builf ffmpeg found in line 67108 in libavcodec.so.56 Clearly they disabled ac3, maybe one could build it with ac3.

--prefix=/usr/pkg --incdir='${prefix}/include/ffmpeg' --arch=i686 --target-os=linux --cross-prefix=/usr/local/i686-pc-linux-gnu/bin/i686-pc-linux-gnu- --enable-cross-compile --enable-optimizations --enable-pic --enable-gpl --enable-version3 --enable-nonfree --enable-libfaac --enable-encoders --enable-pthreads --disable-muxer=image2 --disable-muxer=image2pipe --disable-swscale-alpha --disable-ffplay --disable-ffserver --disable-doc --disable-devices --disable-bzlib --disable-altivec --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libmp3lame --disable-decoder=amrnb --disable-encoder=zmbv --disable-encoder=dca --disable-encoder=ac3 --disable-encoder=ac3_fixed --disable-encoder=eac3 --disable-decoder=eac3 --disable-encoder=truehd --disable-decoder=truehd --cc=/usr/local/i686-pc-linux-gnu/bin/i686-pc-linux-gnu-ccache-gcc --enable-shared --disable-static --enable-yasm --enable-libx264 --enable-encoder=libx264 --enable-libh264_smd --enable-smd --disable-filter=hqdn3d --extra-libs='-ljson-c -lgdl -losal -lpal -lsven -lismd_core -lismd_audio -lismd_viddec -lismd_videnc -lismd_vidpproc -lplatform_config -lffmpeg_plugin' libavcodec license: nonfree and unredistributable avcodec_encode_audio() does not support this codec

Also it could be patching the libavcodec56.so so it cant reach the unnsupported codec could work.

image

mreid-tt commented 6 years ago

@techbliss this is a little over my level of expertise. If any of you guys can build a new libavcodec.so.57 using this concept I would be happy to test it for you. Otherwise maybe some step by step build instructions for those of us not too familiar?

E-t-z commented 6 years ago

Interestingly, it still works on my unit as I just tested.

DS916+, DSM 6.2-23739, Video Station 2.4.1-1554, ffmpeg 3.4.1-9

Tested with video file, which has DTS audio track and is obviosly not compatible with Synology ffmpeg impementation due to that.

mreid-tt commented 6 years ago

@E-t-z Well based on previous tests DTS should work (see https://github.com/SynoCommunity/spksrc/issues/2952#issuecomment-370762929) but this thread was about video with EAC3 audio. This should fail for you, can you confirm?

E-t-z commented 6 years ago

@houndtt as I understood, main problem was third party ffmpeg not being called, in that case it should not matter what codec is being used, unless it is being supported by the Video Station built in ffmpeg. Fair enough, I will try to find somekind of Demo clip with EAC3 audio and will test it out.

Right now, it still looks like (by observing ps output), it calls external ffmpeg when one is present, at least when audio codec is DTS.

E-t-z commented 6 years ago

Looks like content using EAC3 as audio codec is quite scarce at best, so far I have been unable to find any demo clips with it. All of them are AC3, DTS, Atmos or whatnot.

Only thing I was able to get my hands on was this: http://www.demo-world.eu/download-2d-trailers/?file=dolby_digital_plus_channel_check_lossless-DWEU.mkv&pic=dolby_digital_plus_channel_check_lossless.jpg

Yep, and you were correct: DTS works, EAC3 (at least that particular 7.1 channel one) does not. Still it would be quite interesting to understand, why it happily sideloads third party ffmpeg for DTS but not for EAC3?

kajolab commented 6 years ago

So, that would mean that Video Station 2.4.1-1554 supports DTS natively, with no hacks? I am not very technical, just have been following this discussion in order to find a solution to the common problem.

E-t-z commented 6 years ago

No, it does not mean that, for DTS you still need third party ffmpeg, according to my testing.

kajolab commented 6 years ago

Thanks a lot - but that's a bad news...I keep using the workaround described earlier in this discussion and refrain from updating the Video Station until anything else comes up. Thanks for keeping up the good work, and sharing it.

E-t-z commented 6 years ago

For me that hack works for DTS even on newest Video Station (2.4.1-1554), for EAC3 it does not. Next, I will try to figure out how and what decides this selection process and maybe I will come up with something.

Tweaqer commented 6 years ago

No luck so far?

ymartin59 commented 6 years ago

I re-open. I find it interesting. Maybe @E-t-z will find a hint how to progress on that point.

E-t-z commented 6 years ago

OK, it seems rather interesting indeed. After updating VideoStation to 2.4.2-1561, DTS is broken as well.

If I attempt to play back file with DTS all I get is "spinning wheel" and it does not play. ps -ef | grep ffmpeg shows that ffmpeg is not running so it is not being loaded at all, neither 3rd party or built in one.

Uninstalling synocommunity ffmpeg package fixes the issue, no "spinning wheel" but an regular "Audio track not supported" error.

ghost commented 6 years ago

@E-t-z This issue doesn't appear to be limited to 2.4.2-1561 as I have experienced the exact same issue when using previous versions on my 216Play.

To make things even more confusing: I am currently running 2.4.2-1561 and DTS usually works perfectly fine until it magically stops working (with the spinning circle just as you described).

Have you tried rebooting your NAS already? That usually fixes the issue for me. Surely inconvenient, but a workaround, i guess?

(I have no idea why this is happening though. And the apparently non-existing log files don't help either.)

I think that it does load ffmpeg though. After clicking play on a video I hammered in ps -ef | grep ffmpeg repeatedly into my ssh console and eventually ffmpeg came up (but terminated shortly after).

mreid-tt commented 6 years ago

Interesting @mac80211. For me the DTS playback has always been stable. My current setup is as follows:

As for the ffmpeg running and quickly terminating I believe that this is only called for the initial audio transcoding before streaming but does not run after that.

E-t-z commented 6 years ago

In my case reinstalling ffmpeg from SynoCommunity fixed this, still I have been unable to understand by which means Video Station decides when to actually call it.

For DTS it loads SynoCommunity one for E-AC3 it does not.

JernejCG commented 6 years ago

I seem to have issues with AC3 occasionally. Very inconsistent... Does anyone know if the videostation update is safe to do? Or does it create new compatibility issues?

wouterroos commented 6 years ago

@JernejCG I recently updated to the latest version (v2.4.3-1565) and this still breaks E-AC3 support. Since I almost exclusively watch video's on Android TV in my home, I disabled transcoding and set the DS Video app to always use an external player (MX player with a custom codec). This allows me to watch AC3, E-AC3 and DTS video without issues, be it without using the transcoding capabilities of my DS214Play...

kajolab commented 6 years ago

@wouterroos, perhaps a bit off topic, but I am trying to reproduce exactly what you did. Could you shortly describe how did tell DS Video app to use specifically MX player? Thanks in advance.

wouterroos commented 6 years ago

@kajolab on DS Video for Android TV I did the following:

  1. Select 'Settings' from the main menu after signing in
  2. Select 'Video Settings'
  3. Set 'Video Transcoding' to 'Off'
  4. Set 'Set third-party player as default' to 'On'

After that it always defaulted to MX Player (which is the only stand-alone player I have installed on my Android TV). To get MX Player to use a custom codec, refer to https://forum.xda-developers.com/apps/mx-player/mx-player-custom-codec-dts-support-t2156254

kajolab commented 6 years ago

Thanks!

JernejCG commented 6 years ago

@wouterroos what would be a practical solution for Apple TV?

E-t-z commented 6 years ago

@JernejCG VLC?

JernejCG commented 6 years ago

@E-t-z very true, for most people. Since I use an overhead projector and airplay the sound to an amplifier VLC is useless. They somehow haven't implemented the 2 second delay needed to have audio and video in sync. And unfortunately the app on tvOS has no option to set that manually.

wouterroos commented 6 years ago

@JernejCG I don't have Apple TV so unfortunately I'm not able to help you there.

repmeer commented 6 years ago

I have already given up using videostation. I use Plex on my Apple TV. It plays all type op video and audio codecs.

JernejCG commented 6 years ago

@repmeer Do you have to be online for Plex? It used to be so

x-Felix commented 5 years ago

I have already given up using videostation. I use Plex on my Apple TV. It plays all type op video and audio codecs.

@repmeer How you access the video files on NAS from Plex on Apple TV? Has the Plex service pack to be installed on Synology too? Sorry, haven't used Plex before.

zzarbi commented 5 years ago

Same! I use Plex, bought a older mac mini and just share media via network (some issue when the Nas restarts). Plex itself is free but if you want to be able to use from anywhere i think you have to buy a membership or a lifetime membership.

mreid-tt commented 5 years ago

So I've been thinking about this issue and based on the comments from @cr03, I was going to try to build my own version of the 'ffmpeg' binaries to see if we can use the same method of file replacement that @HandyHarry suggested but with the current version. I first started to look at the difference in the 'ffmpeg' between VideoStation 2.3.4-1468 and the current 2.4.3-1565. From the output it seems that the newer one uses a custom build of 'ffmpeg' as follows:

Output from 2.3.4-1468:

admin@Demo-NAS:/var/packages/VideoStation/target/bin$ sudo ./ffmpeg -encoders
ffmpeg version 2.7.1 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.3 (crosstool-NG 1.20.0) 20150311 (prerelease)
  configuration: --prefix=/usr/pkg --incdir='${prefix}/include/ffmpeg' --arch=i686 --target-os=linux --cross-prefix=/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu- --enable-cross-compile --enable-optimizations --enable-pic --enable-gpl --enable-version3 --enable-nonfree --enable-libfaac --enable-encoders --enable-pthreads --disable-muxer=image2 --disable-muxer=image2pipe --disable-swscale-alpha --disable-ffplay --disable-ffserver --disable-doc --disable-devices --disable-bzlib --disable-altivec --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libmp3lame --disable-decoder=amrnb --disable-encoder=zmbv --cc=/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-ccache-gcc --enable-shared --disable-static --enable-yasm --enable-libx264 --enable-encoder=libx264
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100

Output from 2.4.3-1565:

admin@Demo-NAS:/var/packages/VideoStation/target/bin$ sudo ./ffmpeg -encoders
ffmpeg version AudioStation-6.4.2-3330-180711 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.9.3 (crosstool-NG 1.20.0) 20150311 (prerelease)
  configuration: --prefix=/usr/pkg --incdir='${prefix}/include/ffmpeg' --arch=i686 --target-os=linux --cross-prefix=/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu- --enable-cross-compile --enable-optimizations --enable-pic --enable-gpl --enable-version3 --enable-nonfree --enable-encoders --enable-pthreads --disable-muxer=image2 --disable-muxer=image2pipe --disable-swscale-alpha --disable-ffplay --disable-ffserver --disable-doc --disable-devices --disable-bzlib --disable-altivec --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libmp3lame --disable-decoder=amrnb --disable-encoder=zmbv --disable-encoder=dca --disable-decoder=dca --disable-encoder=ac3 --disable-encoder=ac3_fixed --disable-encoder=eac3 --disable-decoder=eac3 --disable-encoder=truehd --disable-decoder=truehd --extra-cflags=-I/usr/local/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sys-root/usr/pkg/include --extra-ldflags=-L/usr/local/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sys-root/usr/pkg/lib --cc=/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-ccache-gcc --enable-shared --disable-static --enable-yasm --enable-libx264 --enable-vaapi --enable-encoder=h264_vaapi --enable-encoder=libx264
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100

Based on the library file versions it seems that this was built using FFmpeg 3.3.9 "Hilbert" which seems to match the versions at https://www.ffmpeg.org/download.html.

Now attempting to build a version on my Synology VM using the generic guide (https://trac.ffmpeg.org/wiki/CompilationGuide/Generic), there are a number of components which are missing including 'gcc-4.9.3' (which I got from https://ftp.gnu.org/pub/pub/gnu/gcc/gcc-4.9.3/) and 'crosstool-ng-1.20.0' (which I got from http://crosstool-ng.org/download/crosstool-ng/). At least these were the things I thought I needed based on the 'ffmpeg' output above.

Now that I have them trying to install them has proven challenging and I got stuck. I'm wondering if this should be compiled on a Synology at all or if it would be simpler to fire up an Ubuntu or other Linux machine and build it there. Any thoughts from the community on the best way forward?

techbliss commented 5 years ago

In theory you should be able to cross compile from a linux distro. https://trac.ffmpeg.org/wiki/CompilationGuide/CrossCompilingForWindows. But i think the best option is to use a similar architecture , like building it on the NAS itself. Maybe use a linux docker container on the nas, should make everything easier

Also i think the right build prefix is what i mentioned on May 7 in this thread. Where you can see they spesific disable the ec3

--prefix=/usr/pkg --incdir='${prefix}/include/ffmpeg' --arch=i686 --target-os=linux --cross-prefix=/usr/local/i686-pc-linux-gnu/bin/i686-pc-linux-gnu- --enable-cross-compile --enable-optimizations --enable-pic --enable-gpl --enable-version3 --enable-nonfree --enable-libfaac --enable-encoders --enable-pthreads --disable-muxer=image2 --disable-muxer=image2pipe --disable-swscale-alpha --disable-ffplay --disable-ffserver --disable-doc --disable-devices --disable-bzlib --disable-altivec --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libmp3lame --disable-decoder=amrnb --disable-encoder=zmbv --disable-encoder=dca --disable-encoder=ac3 --disable-encoder=ac3_fixed --disable-encoder=eac3 --disable-decoder=eac3 --disable-encoder=truehd --disable-decoder=truehd --cc=/usr/local/i686-pc-linux-gnu/bin/i686-pc-linux-gnu-ccache-gcc --enable-shared --disable-static --enable-yasm --enable-libx264 --enable-encoder=libx264 --enable-libh264_smd --enable-smd --disable-filter=hqdn3d --extra-libs='-ljson-c -lgdl -losal -lpal -lsven -lismd_core -lismd_audio -lismd_viddec -lismd_videnc -lismd_vidpproc -lplatform_config -lffmpeg_plugin

m4tt075 commented 5 years ago

@ymartin59 @cytec I've been reviewing this thread. Here my takeaways:

My conclusions:

Do you agree with this approach?

Note to those trying to resemble the Synology ffmpeg builds: I believe Synology is publishing their source code (including ffmpeg) here: https://sourceforge.net/projects/dsgpl/files/Synology NAS GPL Source/ I'd use that as starting point...

ymartin59 commented 5 years ago

I agree with all points. I have not investigated how VideoStation uses ffmpeg or loads ffmpeg libraries... Probably API or options no longer match. My idea is to investigate VideoStation later and try to design an hack - for instance a "bridge" to use recent ffmpeg. Synology sources may help, for the bridge and/or to port "optimization" patches to recent ffmpeg if we feel super-heros

m4tt075 commented 5 years ago

LOL In that case, I'll have to leave the super-hero stuff to you then. Beyond my pay-grade... ;-)

cytec commented 5 years ago

Well personally i didn't care at all about the VideoStation stuff.. it was nice to have while it worked but it never was the initial scope of the package when i created it (mainly to provide a version with most codecs for video conversion and some dependencies) so i'm fine with just going back to the roots there ;)

mreid-tt commented 5 years ago

Thanks guys for taking up the mantle to work on this. I've been struggling to get anywhere with my pet project. I wasn't able to build anything in my Synology VM and then started to look at the generic package builds from Synology. These they seem to build on a Linux box and while they have open source packages here, they only go up to DSM 5.2. I even reached out to their support team but their only feedback was "Our developers plan on getting DSM 6+ published at some point, however they've not provided a specific time window for that".

I really hope the future work on the FFmpeg 4 community package finds a sustainable solution to this issue. Best regards and do let me know if you have any alpha or beta builds you want any help testing.

Hubfront commented 5 years ago

I have a DS214play and seldom use Video Station. I have this ffmpec package from cytec installed on the DS and video with DTS tracks is nicely played by videostation 2.4.4-1580, which starts 6 ffmpec processes to transcode i assume. I tested Video Station again today on my WinPC within Firefox, it plays DTS movies without problems. A movie with a EACS track though is not played at all: ffmpec is not started and videostation is saying that the audio track is not supported. So it seems the newest video station for my DS at least plays together with ffmpec regarding video with DTS tracks. EACS support by Video Station meaning that it starts ffmpec doing the transcoding is missing, maybe because they dont have a solution yet to satisfy licence questions?

ymartin59 commented 5 years ago

New GPL compliant FFmpeg 4.1 package has been published. Thanks to @m4tt075 May anyone interested please install and do some testing to confirm progress on that subject

mreid-tt commented 5 years ago

Hi @ymartin59, I performed an upgrade on a virtual DSM instance. While the DTS performed as well as it did before, the E-AC3 content failed to play with the current Video Station version 2.4.4-1580.

I also performed a ps auxwf while streaming and the following output was gathered for the DTS playback:

VideoSt+ 16375  0.0  0.4 384864  8480 ?        S    22:55   0:00 synoscgi_SYNO.VideoStation2.Streaming_1_stream
root     16377  0.0  0.3 384864  8080 ?        S    22:55   0:00  \_ synoscgi_SYNO.VideoStation2.Streaming_1_stream
root     16378  124  0.8 186952 17256 ?        Rl   22:55   0:01      \_ /var/packages/ffmpeg/target/bin/ffmpeg -ss 0.000 -i /volume1/video/dts_orchestra_long_core_1080p-thedigitaltheater.mkv -threads 0 -acodec libmp3lame -ab 256k -ac 2 -vcodec copy -vsync 2 -map 0:0 -map 0:1 -f mpegts -vbsf h264_mp4toannexb pipe:
root     16379 26.0  0.7  90072 14780 ?        S    22:55   0:00      \_ /var/packages/VideoStation/target/bin/ffmpeg -ss 0.000 -i - -threads 0 -vcodec copy -vsync 2 -vbsf h264_mp4toannexb=repeatheader -f ssegment -segment_format mpegts -segment_list_type m3u8 -hls_seek_time 0 -segment_time 8 -segment_time_delta 0.000 -segment_start_number 00000 -avoid_negative_ts 0 -break_non_keyframes 0 -acodec copy -map 0 /tmp/VideoStation/HLS/c55f3b760ed34ae415039099b0389954_HsB2asMp/slice-%05d.ts

No similar process was seen for the E-AC3 playback as I assume the process never kicked off. Hope this helps.

ymartin59 commented 5 years ago

Sorry but I requested to test FFmpeg package and command line provided by it... Not Video Station for which probably nothing can be done.

neves-0 commented 5 years ago

Hi,

Here is my ugly patch to be able to play a video with EAC3 audio in VideoStation (2.4.4-1583), the WebUI.

1 - Install ffmpeg community package 2 - ssh to DSM, sudo as root 3 - Execute these commands:

# replace old ffmpeg binary by the one from the community package, and filter unsupported "hls_seek_time" option
mv /var/packages/VideoStation/target/bin/ffmpeg /var/packages/VideoStation/target/bin/ffmpeg.old
echo H4sIAMiai1wAA32SMU/DMBCF9/sVhxuhBhRMWatUXRgYEAOiS1VVbnJOrCaxFZsyAP+d2KlQUgU8WXf33vN98uyKH1TDD8KWADPKSo0sWjNcrZC72nApa0PFXaULANEWNp3H8FGqinC7xWiGSeHwHnc7yDVkwlKnXjBUDWB3krKye0t03DtVUxxqtlTShduomXpdKC+XvVZdztf6pAZz/jW36ZwlioXQeKi+iUczwzZZkUHvmuuGfrd+ftk8PWKKUciZJqAk8pNouRHZURRk+UblpF+dcEo33HVx5AJPKU2rD57G2e1hdb3ALyxaMsjeGvtujG4d5ZjpnDK2RFdSgNap03FG/4Cxu68AVZZgSGJE1FMZF+Jp/793CIvrKgepACw5TJLO9NPnbde7b3ZGF3XTU7j+/059d4py8PMy+AEpctu1ngIAAA==|base64 -d|gunzip > /var/packages/VideoStation/target/bin/ffmpeg
chown VideoStation:VideoStation /var/packages/VideoStation/target/bin/ffmpeg
chmod 755 /var/packages/VideoStation/target/bin/ffmpeg

# remove "eac3" from blacklisted codecs in LibSynoVTE::ArgumentHelper::AbleToDecodeAudioByCodec()
cp /var/packages/VideoStation/target/lib/libsynovte.so /var/packages/VideoStation/target/lib/libsynovte.so.old
sed -i 's/eac3/ZXXZ/' /var/packages/VideoStation/target/lib/libsynovte.so

Maybe the ffmpeg package manager could add this synology patch that adds support for the "hls_seek_time" option?

https://gist.github.com/tmm1/280f11b9c252cec87167c4bd406b508c

or just silently ignore this option.

Tested on DS416play, DSM 6.2.1-23824 Update 6, VideoStation 2.4.4-1583 Linux ds416 3.10.105 #23824 SMP Tue Feb 12 16:50:45 CST 2019 x86_64 GNU/Linux synology_braswell_416play

mreid-tt commented 5 years ago

Hey @neves-0, I have no idea what you are doing above but it works! Ran your steps on my DSM VM running DSM 6.2-23739 and VideoStation 2.4.4-1583. The output from the modified build is as follows:

admin@Demo-NAS:/var/packages/VideoStation/target/bin$ sudo ./ffmpeg -encoders
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 4.9.3 (crosstool-NG 1.20.0) 20150311 (prerelease)
  configuration: --target-os=linux --cross-prefix=/spksrc/toolchains/syno-x64-6.1/work/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu- --prefix=/var/packages/ffmpeg/target --extra-cflags=-I/spksrc/spk/ffmpeg/work-x64-6.1/install/var/packages/ffmpeg/target/include --extra-ldflags=-L/spksrc/spk/ffmpeg/work-x64-6.1/install/var/packages/ffmpeg/target/lib --extra-libs='-lxml2 -ldl' --pkg-config=/usr/bin/pkg-config --ranlib=/spksrc/toolchains/syno-x64-6.1/work/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-ranlib --enable-cross-compile --enable-rpath --enable-pic --enable-shared --enable-gpl --enable-fontconfig --enable-libass --enable-libbluray --enable-avresample --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopus --enable-libsoxr --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-gnutls --disable-debug --disable-doc --disable-static --arch=x86_64 --enable-thumb --enable-vaapi
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100

I do notice that the revised ffmpeg binary is much smaller than the previous one but it does seem to be stable. Can you shed some light as to what exactly you are doing with these commands for my understanding?

neves-0 commented 5 years ago

I have no idea what you are doing above but it works!

Nice :)

I do notice that the revised ffmpeg binary is much smaller than the previous one but it does seem to be stable. Can you shed some light as to what exactly you are doing with these commands for my understanding?

The first set of commands replaces the VideoStation ffmpeg binary by a shell script that calls the ffmpeg community package binary, with the exception that it takes away the "hls_seek_time" option added by Synology. If we do not do this, the ffmpeg from the community package prints an error and stops. You can use this command to view this script:

cat /var/packages/VideoStation/target/bin/ffmpeg

The second set of commands removes "eac3" from a blacklisted codec list in an internal function of a Synology library. It would have been cleaner to make the LibSynoVTE::ArgumentHelper::AbleToDecodeAudioByCodec() function always return True, but patching the "eac3" string is more generic and allows to support all platforms (with a different instruction set).

m4tt075 commented 5 years ago

@neves-0 Crikey! What a clever workaround. And sustainable for future updates. Kudos! Looking at the ffmpeg patch makes me shiver, though. I don't use Videostation at all, and, thus, have no appetite to port the patch to ffmpeg-4.1.x. But maybe someone else is willing to take it on...

kajolab commented 5 years ago

That sounds great, and I am not a programmer at all. And that's why I would need to know the following before i go ahead with this:

  1. Should I first uninstall the old VideoStation 2.3.4, that I run now?
  2. Can I revert to the old one if the workaround doesn't work?

I appreciate your answers.