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
lgxmedia commented 5 years ago

neves-0 thanks a lot, it works!

kajolab u don't need uninstall, just start ssh, putty, copy/paste commands and done

later edit: there is a problem if u want to move at different time like middle of the movie, it freeze and cpu at 99% (with or without eac3 codec)

neves-0 commented 5 years ago

later edit: there is a problem if u want to move at different time like middle of the movie, it freeze and cpu at 99% (with or without eac3 codec)

indeed :(

I updated my previous comment to modify the script: it will now use the FFMPEG community binary only when the default one from VideoStation fails with "Unsupported codec". It does not correct the problem but it avoids spreading it to other non eac3 videos.

Here is the new script:

#!/bin/bash

#echo "$@" >> /tmp/ffmpeg.log

args=()
while [[ $# -gt 0 ]]
do
case "$1" in
    -hls_seek_time)
    shift
    hls_seek_time="$1"
    ;;
    -i)
    shift
    movie="$1"
    args+=("-i" "$1")
    ;;
    *)
    args+=("$1")
    ;;
esac
shift
done

#echo "MOVIE = $movie" >> /tmp/ffmpeg.log

if /var/packages/VideoStation/target/bin/ffprobe "$movie" 2>&1 | grep "Unsupported codec"; then
   bin=/var/packages/ffmpeg/target/bin/ffmpeg
else
   args+=("-hls_seek_time" "$hls_seek_time")
   bin=/var/packages/VideoStation/target/bin/ffmpeg.old
fi

set -- "${args[@]}"
#echo $bin >> /tmp/ffmpeg.log
#echo "$@" >> /tmp/ffmpeg.log
#echo >> /tmp/ffmpeg.log

$bin "$@"

What is strange is that when the CPU is at 99% and VideoStation freezes, ffmpeg is working to create slices of the video, it is doing its job well. I don't understand yet.

rschneider1509 commented 5 years ago

I updated my previous comment to modify the script: it will now use the FFMPEG community binary only when the default one from VideoStation fails with "Unsupported codec". It does not correct the problem but it avoids spreading it to other non eac3 videos.

Here is the new script:

@neves-0 so if i get this right, u implemented your "new script" into the "echo" command in your first tutorial, right?

mreid-tt commented 5 years ago

Hi @neves-0, I was able to test in more detail (original script not the new one) in my virtual DSM and I indeed was able to confirm differences in CPU load. In the original VideoStation 2.3.4-1468 it experiences CPU spikes around 60% when playing back and scrubbing through E-AC3 video and around 65% CPU when playing back and scrubbing through DTS video. For your script I see the near 100% CPU spikes for playing and scrubbing through E-AC3 video and weirdly I see the same near 100% CPU when playing but it seems to stop playing when I try to scrub through DTS video.

Based on this I'm going to hold off putting this solution into my live NAS since it would have a lot more processes running as well as several concurrent users. I hope we get to figure out why a specific function call to the community binary would behave differently than with previous versions since I thought older versions called the community binary anyway (for DTS, etc.) but maybe in a different way?

ymartin59 commented 5 years ago

Interesting point... Googling "hls_seek_time" lands me to: https://gist.github.com/tmm1/280f11b9c252cec87167c4bd406b508c So it may be possible to backport that support to recent FFmpeg version, hopefully with reasonable effort... if anyone is willing to work "for" Synology ;)

This comes from GPL violation reports: https://trac.ffmpeg.org/ticket/5814 And following blog may help to reproduce Video Station FFmpeg build: https://pcloadletter.co.uk/2017/01/07/cross-compiling-ffmpeg-for-serviio-1-8-with-shared-libraries-on-synology-nas-for-7-cpu-architectures/ including hardware transcoding thanks to Evansport SMD: https://emby.media/community/index.php?/topic/43282-hw-transcoding-on-evansport-ds415playds214play-machines/ or VAAPI supports.

About ffmpeg cpu consumption, I really doubt VAAPI works well in our latest build. It would be interesting to get verbose/debug output of ffmpeg commands as confirmation.

neves-0 commented 5 years ago

@rschneider1509 that's right.

@houndtt I think the only real solution is to force Synology to publish the changes made to ffmpeg in VideoStation, as they have to do. With this patch, I'll take the time to recompile a Synology-compatible ffmpeg with all codecs.

@ymartin59 This is a patch for ffmpeg 2.7.1, a very old version from 2014. ffmepg in Videostation is 3.3.7, and 4.1 in ffmpeg community package. I'm not sure I want to waste my time applying this patch for the 2.7.1 version, especially since there may be some new options missing and new VideoStation patches applied to version 3.3.7.

The ffmpeg CPU consumption seems linked to a sort of infinite loop of transcoding, as if ffmepg did not get the order to stop. I have no time to investigate currently.

@kc6108 For TrueHD, try this (untested) : sed -i 's/truehd/blabla/' /var/packages/VideoStation/target/lib/libsynovte.so

For DTS, it should be OK by installing the ffmpeg community package. Here is the pseudo code of the AbleToDecodeAudioByCodec function:

if codec is in blacklist, return 0 if codec is not dts, return 1 if custom ffmpeg (/var/packages/ffmpeg/target/bin/ffmpeg) is not installed, return 0 if custom ffmpeg supports dts, return 1

ymartin59 commented 5 years ago

@neves-0 Many thanks for your effort in these investigations. You're right, it makes sense that Synology has to publish its own patch for 3.3.7... probably ffmpeg community has to trigger the "gpl violation" argument again.

mreid-tt commented 5 years ago

Hmmm, should we start a petition at a site like change.org to send to the management of Synology to update their open source submissions to include DSM 6.2?

x-Felix commented 5 years ago

These packages will need to be updated to at least the versions listed to work on DSM 6.2.2. You will not be able to use them in DSM 6.2.2 unless you update it.

Video Station – 2.4.5-1583

Synology has forced user to update video station to run on new DSM 6.2.2.

Mask commented 5 years ago

https://sourceforge.net/projects/dsgpl/files/Packages/DSM%206.1%20Package%20Release/

Are these the sources everyone is looking for? The VideoStation tarballs contain ffmpeg 3.3.7 sources. Didn't look at them closely yet though.

toaster-code commented 5 years ago

Based on what @Mask pointed out I did a clone of the ffmpeg repository at version 3.3.7, which is the same as the one relased by synology to find the patches added by synology to the original code.

I did a "diff" using git and if I manage to find how to compile the source I plan to build my own binary. The problem is that I am not a programmer and I do not know how to compile the source.

Any help?

In the ffmpeg_opt.c I found the code that is blocking the audio codecs:

https://pastebin.com/NcWrmMfz

avbfr commented 5 years ago

Based on what @Mask pointed out I did a clone of the ffmpeg repository at version 3.3.7, which is the same as the one relased by synology to find the patches added by synology to the original code.

I did a "diff" using git and if I manage to find how to compile the source I plan to build my own binary. The problem is that I am not a programmer and I do not know how to compile the source.

Any help?

In the ffmpeg_opt.c I found the code that is blocking the audio codecs:

https://pastebin.com/NcWrmMfz

Actuelly, you can just comment lines 46,47 and 48 in synoconfig.h

_#if !defined(STANDALONE) && !defined(MY_ABC_HERE) && !defined(SYNO_MEDIASERVER)

define SYNO_SKIP_DISABLED_AUDIO_STREAM

endif_

I tried to run the configure and make commands successfully with this configuration (after having installed dependencies on an Ubuntu VM):

--arch=i686 --target-os=linux --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 --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

Unfortunatly, the web video player doesn't start with there binaries (It scrolls indefinitely when playing the video).

I think there is something wrong with my Synology Dev Environment...

binaries.zip

toaster-code commented 5 years ago

Based on what @Mask pointed out I did a clone of the ffmpeg repository at version 3.3.7, which is the same as the one relased by synology to find the patches added by synology to the original code. I did a "diff" using git and if I manage to find how to compile the source I plan to build my own binary. The problem is that I am not a programmer and I do not know how to compile the source. Any help? In the ffmpeg_opt.c I found the code that is blocking the audio codecs: https://pastebin.com/NcWrmMfz

Actuelly, you can just comment lines 46,47 and 48 in synoconfig.h

_#if !defined(STANDALONE) && !defined(MY_ABC_HERE) && !defined(SYNO_MEDIASERVER) #define SYNO_SKIP_DISABLED_AUDIOSTREAM #endif

I tried to run the configure and make commands successfully with this configuration (after having installed dependencies on an Ubuntu VM):

--arch=i686 --target-os=linux --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 --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

Unfortunatly, the web video player doesn't start with there binaries (It scrolls indefinitely when playing the video).

I think there is something wrong with my Synology Dev Environment...

binaries.zip

Thanks for the feedback. I got to the same conclusion as you but still I do not have the skills to do that. I will wait for someone to continue those steps and build a binary (ou maybe patch a most recent ffmpeg). Did you change the permissions for the binaries? maybe that was the problem.. I will test here

avbfr commented 5 years ago

Yes, I did (even the suid). ;-)

toaster-code commented 5 years ago

Yes, I did (even the suid). ;-) Maybe you should build the libraries (--enable-static --enable-shared)...

avbfr commented 5 years ago

Already tried, Unfortunately, I encountered issues when building shared libraries so I tried to configure the Synology Dev Env but same results.

stoodi commented 5 years ago

Anyone did build with success ?

techbliss commented 5 years ago

You can try this build command 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

toaster-code commented 5 years ago

I don't know how to do that. Can I do it directly with my synology NAS or I need to use some linux PC, install some packages and try to use "make config" with those parameters pointed by techbliss?

melgu commented 5 years ago

Thanks @HandyHarry! My files were in slightly different locations so my steps were as follows:

  1. Backup the (version 2.3.4-1468) files using the following commands:
cp /volume1/@appstore/VideoStation/lib/libsynovte.so [backup location]
cp /volume1/@appstore/VideoStation/lib/ffmpeg/libavcodec.so.56 [backup location]

...

Does this still work? If yes, does someone have the necessary files, as I can't downgrade to that VideoStation version due to the OS being too recent?

ikbenignace commented 5 years ago

@neves-0 , the fix you provide for the webUI works great, but now I'm asking how to fix the offline transcoding for DTS and EAC3.

EngMarc commented 5 years ago

@neves-0, I put in your script and did all the commands. 1) tested a known eac3 audio codec video which doesn’t play the audio and gives the error that audio isn’t supported. 2) ran the ‘sed’ command to remove the eac3 from the LibSynoVTE 3) tried the same eac3 video, now it plays but has no video nor audio but has the subtitles 4) ran the mv and echo commands. retried the same video with eac3 audio codec. It doesn’t play but the time counter starts counting.

I did check all the versions of ffmpeg prior to doing your set of commands. /bin/ffmpeg -> 2.7.1 /var/packages/VideoStation/target/bin/ffmpeg -> 3.3.7 /var/packages/ffmpeg/target/bin/ffmpeg -> 4.1

I edited your script with ‘vi’ (I’m an old unix admin) to remove the comment ‘#’ to see what was happening in the log. Here’s the contents of the /tmp/ffmpeg.log

"-ss 0.000 -i /volume2/video/myvideo.mkv -threads 0 -vcodec libx264 -vsync 2 -preset superfast -vprofile baseline -level 30 -s 1920x1080 -vb 1700994 -acodec libmp3lame -ab 128k -ac 2 -f ssegment -pix_fmt yuv420p -segment_format mpegts -segment_list_type m3u8 -hls_seek_time 0 -segment_time 5 -segment_time_delta 0.000 -segment_start_number 00000 -individual_header_trailer 0 -avoid_negative_ts 0 -break_non_keyframes 1 -max_muxing_queue_size 1024 -map 0:0 -map 0:1 /tmp/VideoStation/HLS/659a143956ab57c58c544008c8902a2b_CXS5Hsyh/slice-%05d.ts MOVIE = /volume2/video/myvideo.mkv /var/packages/ffmpeg/target/bin/ffmpeg

-ss 0.000 -i /volume2/video/myvideo.mkv -threads 0 -vcodec libx264 -vsync 2 -preset superfast -vprofile baseline -level 30 -s 1920x1080 -vb 1700994 -acodec libmp3lame -ab 128k -ac 2 -f ssegment -pix_fmt yuv420p -segment_format mpegts -segment_list_type m3u8 -segment_time 5 -segment_time_delta 0.000 -segment_start_number 00000 -individual_header_trailer 0 -avoid_negative_ts 0 -break_non_keyframes 1 -max_muxing_queu e_size 1024 -map 0:0 -map 0:1 /tmp/VideoStation/HLS/659a143956ab57c58c544008c8902a2b_CXS5Hsyh/slice-%05d.ts”

Any ideas or things to try would be helpful. I have a mix of eac3 and aac_lc files that don’t play with the synology dist ffmpeg in VideoStation.

skiwlkr commented 5 years ago

Tried the steps above on my ds216+II. After that my videostation became unusable. Videos weren't playing anymore EAC3 and regualr audio tracks, in the task manager hundred instances of ffmpeg.old showed up and pushing my cpu usage to 90% constantly. Not sure if this is a normal process. I killed the thing after 30 minutes or so. Had to reinstall Videostation to get the whole thing working again :/

RM29 commented 4 years ago

Is there a simple way to read eac3 on web video station and or for transcoding ? I've searched everywhere for an answer :/

skiwlkr commented 4 years ago

Is there a simple way to read eac3 on web video station and or for transcoding ? I've searched everywhere for an answer :/

Easiest way would be a downgrade to Videostation version 2.3.4-1468 I did this on my DS216 play. I experienced some lags every other day, but usually gone after 5 mins. Not sure if this got something to do with the downgrade. you can find the package for manual install here: https://archive.synology.com/download/Package/spk/VideoStation/ When uninstalling the videostation package you'll be asked if you wanna keep your Library. Library works fine with the old version.

You will encounter some High cpu usage while watching eac3 videos because of the transcoding.

SecuritySense commented 4 years ago

Running DSM 6.2.2-24922 Update 4 with VideoStation 2.4.6-1594. Followed the steps at https://github.com/SynoCommunity/spksrc/issues/2952#issuecomment-472705372 above in this thread. ffmpeg community edition is 4.1. When I play a video encoded with H264 and EAC3 audio it plays just fine in VideoStation. When I play a video encoded with H265 and EAC3 audio it will not play. Anyone have any ideas?

th0ma7 commented 4 years ago

FFMPEG 4.2.x patches where merged with possible fix but official package isn't yet available. In the meantime you can give it a shot at testing packages I made available at:

Currently only x64/apollolake packages is available with the fix you are looking for (e.g. -14 packages). Let me know if you use another arch and I'll rebuild the needed packages.

SecuritySense commented 4 years ago

Thanks If I update and it causes issues am I able to downgrade back to 4.1?

SecuritySense commented 4 years ago

I installed ffmpeg_apollolake-6.1_4.2.1-14.spk (I have apollolake architecture) and H265 EAC3 still doesn't play

Yod4z commented 4 years ago

tried but no mutch benef with EAC3 and DTS support on DSvideo android or web videostation. DS916+ dsm 6.2 videostation 2.4.6 I have uninstall the synocommunity and install the x64-14 and reboot the nas.

With synocommunity version x265 movies are woking

Yod4z commented 4 years ago

I can't play EAC3 ou DTS on videostation ether with x265 or x264 But can play x265 with AC3 audio using synocomunity ffmpeg

SecuritySense commented 4 years ago

Got confused. Doing some testing. Back soon!

SecuritySense commented 4 years ago

OK DS918+ DSM 6.2.2-24922 Update 4 VideoStation 2.4.6-1594 th0ma7 ffmpeg_x64-6.1_4.2.1-14.spk

HEVC (265) AAC 6CH PLAYS HEVC (265) AC3 640k PLAYS HEVC (265) EAC3 (1080p content) PLAYS HVEC (265) AC3 4K content PLAYS HEVC (265) EAC3 (files listed as 4K or HDR 2160p WEB-DL DDP5.1) DOES NOT PLAY HVEC (265) DTS DOES NOT PLAY HEVC (265) 7.1/TrueHD/HDR/Atmoc DOES NOT PLAY (even if it has additional AC3 audio streams you can select in VideoStation they do not play)

th0ma7 commented 4 years ago

I wonder a few things:

My ffmpeg output show the following and indeed h265 "decoders" appears missing and worth investigating:

$ /usr/local/ffmpeg/bin/ffmpeg -codecs 2>/dev/null | grep -Ei -e ' e?ac3' -e 'truehd' -e 'dts' -e 'h26[45]' -e 'hevc'
 DEV.LS h264                 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_v4l2m2m ) (encoders: libx264 libx264rgb h264_v4l2m2m h264_vaapi )
 DEV.L. hevc                 H.265 / HEVC (High Efficiency Video Coding) (encoders: libx265 hevc_vaapi )
 DEA.L. ac3                  ATSC A/52A (AC-3) (decoders: ac3 ac3_fixed ) (encoders: ac3 ac3_fixed )
 DEA.LS dts                  DCA (DTS Coherent Acoustics) (decoders: dca ) (encoders: dca )
 DEA.L. eac3                 ATSC A/52B (AC-3, E-AC-3)
 DEA..S truehd               TrueHD

After a bit of investigation it seems the behaviour (e.g. -codecs output) is OK as the relevant line has the "D" at the beginning which associated to the native decoder. List in parentheses only shows up if there are more than one decoder/encoder.

Therefore problem is elsewhere.

SecuritySense commented 4 years ago

Output from the old renamed ffmpeg in VideoStation

 DEV.L. hevc                 H.265 / HEVC (High Efficiency Video Coding) (decoders: hevc hevc_cuvid ) (encoders: nvenc_hevc hevc_nvenc hevc_vaapi )
 D.A.L. ac3                  ATSC A/52A (AC-3) (decoders: ac3 ac3_fixed )
 ..A.LS dts                  DCA (DTS Coherent Acoustics)
 ..A.L. eac3                 ATSC A/52B (AC-3, E-AC-3)
 ..A..S truehd               TrueHD

Output from community ffmpeg

 DEV.L. hevc                 H.265 / HEVC (High Efficiency Video Coding) (encoders: libx265 hevc_vaapi )
 DEA.L. ac3                  ATSC A/52A (AC-3) (decoders: ac3 ac3_fixed ) (encoders: ac3 ac3_fixed )
 DEA.LS dts                  DCA (DTS Coherent Acoustics) (decoders: dca ) (encoders: dca )
 DEA.L. eac3                 ATSC A/52B (AC-3, E-AC-3)
 DEA..S truehd               TrueHD
th0ma7 commented 4 years ago

I might have found a possible solution... New testing package currently only available for apollolake, version -15 at:

@SecuritySense and @Yod4z can you give it a shot? Just let me know if you need a build for another arch.

th0ma7 commented 4 years ago

Based on a few more readings I don't think my latest testing package (-15) will fix the remaining issues noted by @SecuritySense . And I also doubt they can bit fixed at this time although feedbacks more than welcomed.

HEVC (265) EAC3 (files listed as 4K or HDR 2160p WEB-DL DDP5.1) DOES NOT PLAY HVEC (265) DTS DOES NOT PLAY HEVC (265) 7.1/TrueHD/HDR/Atmoc DOES NOT PLAY (even if it has additional AC3 audio streams you can select in VideoStation they do not play)

Although, looking back at the initial bug statement from @houndtt , could it actually be considered solved?

OK DS918+ DSM 6.2.2-24922 Update 4 VideoStation 2.4.6-1594 th0ma7 ffmpeg_x64-6.1_4.2.1-14.spk

HEVC (265) AAC 6CH PLAYS HEVC (265) AC3 640k PLAYS HEVC (265) EAC3 (1080p content) PLAYS HVEC (265) AC3 4K content PLAYS

mreid-tt commented 4 years ago

Thanks @th0ma7, I don't have an Apollolake processor, since according to Synology's KB, my DS916+ has a Braswell processor. Any chance you can build one for me to test? Or give me detailed instructions about how to build (semi-newbie here).

Yod4z commented 4 years ago

I have a ds916+ ans i use the x64 package

EngMarc commented 4 years ago

I have a DS1817+ with a Intel Atom C2538 processor. Not sure if the apollolake pkg will work or if I need to compile a new build (likely). Can anyone out there do a compile build for the C2538 Atom cpu?

mreid-tt commented 4 years ago

I have a ds916+ ans i use the x64 package

What are you saying @Yod4z? You can install the package from th0ma7/synology on your Braswell processor?

th0ma7 commented 4 years ago

Currently building generic x64 package compatbile with apollolake, broadwell, braswell and avoton (C2538) and others, all being x86_64 types:

I'm hoping to find few spare cycles to make them available by the end of day.

th0ma7 commented 4 years ago

Generic x64 package now available ffmpeg_x64-6.1_4.2.1-15.spk. And question is: Is the initial problem fixed?

kajolab commented 4 years ago

Guys, I have the older DS1512+ running Atom D2700 - does it mean I can install the generic package and... update beyond DSM 6.2.1 and Video Station 2.4.6-1594 that I run now? Will EAC3 and DTS play ok?

toaster-code commented 4 years ago

Tried " Generic x64 package ffmpeg_x64-6.1_4.2.1-15.spk https://github.com/th0ma7/synology/blob/master/packages/ffmpeg_x64-6.1_4.2.1-15.spk. " but I got "Video format not suported " in videostation with a video with a DTS audio stream.

Le ven. 13 déc. 2019 à 17:12, Vincent Fortier notifications@github.com a écrit :

Generic x64 package now available ffmpeg_x64-6.1_4.2.1-15.spk https://github.com/th0ma7/synology/blob/master/packages/ffmpeg_x64-6.1_4.2.1-15.spk .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SynoCommunity/spksrc/issues/2952?email_source=notifications&email_token=AABEHT6KT42NHS3ADCNO77LQYOYAHA5CNFSM4D6HNHP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG2N7NY#issuecomment-565501879, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABEHTY2FGTKD7RMD5VYMIDQYOYAHANCNFSM4D6HNHPQ .

melgu commented 4 years ago

Generic x64 package now available ffmpeg_x64-6.1_4.2.1-15.spk.

Are you planning an aarch64 (armv8) release?

Yod4z commented 4 years ago

tried the -15 x64 on my ds916+ in videostation DTS audio or eac3 not supported. I can creat some short video or my movie to see what i mean if you want

Yod4z commented 4 years ago

eac3 file https://framadrop.org/r/_d8ohvmb-E#mQeNKqv8Lg/0Qpj4M+MDeJGDRx06inR6KEDSCojfvA0= dts file https://framadrop.org/r/7VXUoviRnq#9EAD8aPGR6Wswg7Rde8OJ+4N/4lcp6AmkBhqvLhbIs0=

th0ma7 commented 4 years ago

DSM: 6.2.2-24922 VideoStation: 2.4.6-1594 FFMPEG: 4.2.1-15.spk Using a personal file I had in my library I was able to reproduce the DTS error. Although I'm unable to get suitable debug info from VideoStation. Tried setting the log-level to debug using following but wasn't able to get much out of it:

# perl -i'.BACKUP' -pe 's/level(.*)/level(debug..emerg)/g' /volume1/@appstore/VideoStation/etc/syslog-ng.conf
# synoservice --restart pkgctl-VideoStation

Question to me are (and I may well be wrong): 1) Is it possible to determine if the issue is due to VideoStation OR FFMPEG ? 2) how to trace which ffmpeg is really being used by Videostation ?

Note for @melgu, I made available a aarch64 package.

th0ma7 commented 4 years ago

From previous post I downgraded videostation to version 2.3.4-1468. It ended-up that my DTS video played just fine and catching ffmpeg using top:

  PID USER      PR  NI    VIRT    RES  %CPU %MEM     TIME+ S COMMAND                                                                                                     
15377 root      20   0  117.0m  16.1m  98.7  0.1   1:02.72 R /var/packages/VideoStation/target/bin/ffmpeg -ss 0.000 -i /volume1/media/video/film/...

Then also direct ps command:

$ ps auxwf | grep ffmpeg
root     15296 96.2  0.1 122512 19480 ?        Rl   11:07   0:13  \_ /var/packages/VideoStation/target/bin/ffmpeg -ss 792.208 -i /volume1/media/video/film/2016 - 1.54.mkv -threads 0 -vcodec copy -vsync 2 -vbsf h264_mp4toannexb=repeatheader -acodec libmp3lame -ab 256k -ac 2 -f ssegment -segment_format mpegts -segment_list_type m3u8 -hls_seek_time 792208 -segment_time 8 -segment_time_delta 8.208 -segment_start_number 00098 -avoid_negative_ts 0 -break_non_keyframes 0 -map 0:0 -map 0:1 /tmp/VideoStation/HLS/ce7efd3d0c63f2cc602d4600f15d473f_jRj7858x/slice-%05d.ts

Interestingly, version 2.3.4 has the following:

While version 2.4.6 has the following which explains a lot:

Attempt in "adjusting" ffmpeg install of VideoStation 2.3.4 lead to:

2019-12-14T11:20:50-05:00 th0ma7-nas synoscgi_SYNO.VideoStation2.Subtitle_1_get[23222]: APIRunner.cpp:793 cannot open library: /var/packages/VideoStation/target/webapi5/SYNO.VideoStation.VTE.so. error = libmp3lame.so.0: failed to map segment from shared object

Attempt on version 2.4.6 lead to:

2019-12-14T12:16:57-05:00 th0ma7-nas synoscgi_SYNO.VideoStation2.Setting.PreAnalysis_1_get[8307]: APIRunner.cpp:793 cannot open library: /var/packages/VideoStation/target/webapi5/SYNO.VideoStation.so. error = libavformat.so.57: cannot open shared object file: No such file or directory

All in all videostation cgi binaries are compiled against the provided ffmpeg and I do not see any ways for it to be forced to properly use spksrc Synocommunuity ffmpeg. I may be wrong but only two options exists:

  1. Synology to change the VideoStation code to allow external ffmpeg version (including libraries)
  2. Someone comes up with an alternative to force VideoStation to use SynoCommunuity ffmpeg
  3. Use alternative option (personally a cifs share using Kodi would be way more efficient)

To conclude, to me this bug should be closed and opened against Synology directly.