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.04k stars 99 forks source link

[BUG] Stop playing some formats that played before patching #95

Closed dmoskovchenko closed 1 year ago

dmoskovchenko commented 1 year ago

Provide System Details Model: DS220+ DSM version: DSM 7.2-64570 Update 3 Video Station: 3.1.0-3153 FFmpeg 4 /5 /6 from Community centre Logs: https://gist.github.com/dmoskovchenko/2c2a719e4d9c0ab98fbbd13c43aa3955

Describe the bug After patching some videos stop playing, image

If I tried -s -- -a unpatch this videos begin playing.

I need a patch to play videos with eac3 sound. After patching, videos with eac3 sound working well.

Please help me with this issue.

AlexPresso commented 1 year ago

Hello,

I'll have a look at it as soon as I can

AlexPresso commented 1 year ago

Hello @dmoskovchenko

I made a fix attempt in the linked PR, could you try to use the following procedure to test it please:

If you still have an issue please run the issue-report tool and post the result here again

dmoskovchenko commented 1 year ago

Hello, first of all I want to thank you for your work. I have treid ^ image

No changes for me

Here is log file: https://gist.github.com/dmoskovchenko/c8f058d6149bbf83341ac551b14ca1a0

dmoskovchenko commented 1 year ago

After patching on this link(branch) the video picture is strange: image

and if I do unpatch video picture format became normal but without eac3(( :
image

AlexPresso commented 1 year ago

My bad, I inverted the width and height, could you please unpatch and repatch using the same above commands

dmoskovchenko commented 1 year ago

After patching on this link(branch) the video picture is strange: image

and if I do unpatch video picture format became normal but without eac3(( : image

this part is fixed, but in general the videos that plays in unpatched mode still has problem with playing after patching

Here is log: https://gist.github.com/dmoskovchenko/ce76407af830f24ef1257a18c123f64a

AlexPresso commented 1 year ago

Thank you for the feedback I tried to re-add the vaapi to the filter chain, could you please unpatch/repatch using the same commands and give it a try

Could you also give me the ouput of the following command:

dmoskovchenko commented 1 year ago

Tried to repatch - nothig changed :( Here is vainfo: https://gist.github.com/dmoskovchenko/4d87abe48fa9fa470ac94618b0069366

AlexPresso commented 1 year ago

Do you have any output if running /var/packages/VideoStation/target/bin/vainfo ? Unfortunately, I can't test it by myself because my NAS is not having an Intel CPU and so doesn't have VAAPI

dmoskovchenko commented 1 year ago

Here is /var/packages/VideoStation/target/bin/vainfo vainfo.zip

If it is neccesarry I could make a vpn with acces to my nas to fix an issue

AlexPresso commented 1 year ago

Thank you for the report :)

Hello @th0ma7, I hope you're doing well By any chance, do you have an idea why the OP is able to play the video with default ffmpeg but not with the SC's ffmpeg ? For me the args looks pretty similar, could it be possible the SC's ffmpeg is missing the MPEG4 Advanced Simple profile ?

Key infos: https://gist.github.com/dmoskovchenko/c8f058d6149bbf83341ac551b14ca1a0

th0ma7 commented 1 year ago

@AlexPresso the following should provide the list of decoders available, which in turn depends of the platform and ffmpeg version in usage:

$ /usr/local/bin/ffmpeg6 -hide_banner -decoders | grep -i mpeg
 VFS..D ffv1                 FFmpeg video codec #1
 VF..BD ffvhuff              Huffyuv FFmpeg variant
 VFS..D h264                 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
 V....D libopenh264          OpenH264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264)
 V.S.BD mpeg1video           MPEG-1 video
 V..... mpeg1_v4l2m2m        V4L2 mem2mem MPEG1 decoder wrapper (codec mpeg1video)
 V.S.BD mpeg2video           MPEG-2 video
 V.S.BD mpegvideo            MPEG-1 video (codec mpeg2video)
 V..... mpeg2_v4l2m2m        V4L2 mem2mem MPEG2 decoder wrapper (codec mpeg2video)
 V....D mpeg2_qsv            MPEG2VIDEO video (Intel Quick Sync Video acceleration) (codec mpeg2video)
 VF..BD mpeg4                MPEG-4 part 2
 V..... mpeg4_v4l2m2m        V4L2 mem2mem MPEG4 decoder wrapper (codec mpeg4)
 V...BD msmpeg4v1            MPEG-4 part 2 Microsoft variant version 1
 V...BD msmpeg4v2            MPEG-4 part 2 Microsoft variant version 2
 V...BD msmpeg4              MPEG-4 part 2 Microsoft variant version 3 (codec msmpeg4v3)
 A....D mp1                  MP1 (MPEG audio layer 1)
 A....D mp1float             MP1 (MPEG audio layer 1) (codec mp1)
 A....D mp2                  MP2 (MPEG audio layer 2)
 A....D mp2float             MP2 (MPEG audio layer 2) (codec mp2)
 A....D mp3float             MP3 (MPEG audio layer 3) (codec mp3)
 A....D mp3                  MP3 (MPEG audio layer 3)
 A....D mp3adufloat          ADU (Application Data Unit) MP3 (MPEG audio layer 3) (codec mp3adu)
 A....D mp3adu               ADU (Application Data Unit) MP3 (MPEG audio layer 3)
 A....D als                  MPEG-4 Audio Lossless Coding (ALS) (codec mp4als)

And to get more details on a specific decoder:

$ /usr/local/bin/ffmpeg6 -hide_banner -h decoder=mpeg4
Decoder mpeg4 [MPEG-4 part 2]:
    General capabilities: horizband dr1 delay threads 
    Threading capabilities: frame
    Supported hardware devices: vaapi 
    Supported pixel formats: vaapi yuv420p
MPEG4 Video Decoder AVOptions:

Considering DS220+ is a geminilake (x64) pretty much everything should be enabled including vaapi acceleration.

EDIT: in order to use vainfo you must use sudo access or a user account that has group videodriver permissions:

sudo su -s /bin/bash sc-ffmpeg -c '/var/packages/ffmpeg6/target/bin/vainfo'
Password:  ************
Trying display: drm
libva info: VA-API version 1.18.0
libva info: Trying to open /var/packages/ffmpeg6/target/lib/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_18
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.18 (libva 2.18.1)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 23.1.6 (3359d2df)
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointFEI
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointFEI
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointFEI
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileVP8Version0_3          : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointFEI
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD

So issue may well be that the @dmoskovchenko may be using an account which isn't part of the videodriver group

dmoskovchenko commented 1 year ago

Hello, @th0ma7 thx for your answer. Here is New logs: https://gist.github.com/dmoskovchenko/4e5f79795ac0b0da7541e0e7dc1bd0ac with the commands that you provided.

For this time I found another resource with wrapper patcher(as a work around) that helps me to solve the issue , now all formats are played well.

I still want to understand if this problem is only mine and still want to help @AlexPresso to enchance his project :)

AlexPresso commented 1 year ago

Thank you for the feedback @th0ma7 :)

And thank to you @dmoskovchenko for your will to help and for giving informations from the commands, it's highly appreciated 👌. But the one you used are for ffmpeg6 and I see from the issue-report that your patch configuration is using ffmpeg4, could you give me the output of the following commands for ffmpeg4 please (needs sudo):

To give some explainations about my thoughts: The reason why it's working with the other wrapper you're using, is because the other wrapper is in first case, trying to run the transcoding with the default VideoStation's ffmpeg. My wrapper is only using the SynoCommunity's ffmpeg. I decided to do it this way because the SC ffmpeg is having way more capabilities and is containing latest ffmpeg optimizations.

AlexPresso commented 1 year ago

Hello @dmoskovchenko

If you have time, I made a new patch to try my theory about the previous comment, if you are okay to try it here are the steps:

If you still have an issue please run the issue-report tool and post the result here again

PS : If you have time, please also send me the output of the other commands ;)

dmoskovchenko commented 1 year ago

Hello, I have tried new solution and at once everything works fine for me now. Great job. I will stay on your solution, it is nice to be intouch with developer in resolving an issue. I wat to thank you one more time for your work .

dmoskovchenko commented 1 year ago

Fixed

AlexPresso commented 1 year ago

Thank you very much for testing :) I'm glad everything working fine, but could you please just give me the output of the commands in the following comment so I can have a deep understanding of what was not working fine in the first try please: https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher/issues/95#issuecomment-1745398234

dmoskovchenko commented 1 year ago

Here are logs: https://gist.github.com/dmoskovchenko/cea0724f701ea6f7f10192297f90acb0

AlexPresso commented 1 year ago

Thank you :)

Gargaj commented 1 year ago

@AlexPresso Getting the same issue with some HEVC files - work fine before patching, don't work at all after. Log: https://pastebin.com/raw/aWjq4cej

AlexPresso commented 1 year ago

Hi @Gargaj Thank you for the report, could you provide me the video file so I can do some tests locally please ?

Gargaj commented 1 year ago

Any HEVC file will do that has yuv420p10le pixel format: https://www.dropbox.com/scl/fi/0p81fmldvrvxzip6jlv0r/Big_Buck_Bunny_1080_10s_30MB-yuv420p10le.mp4?rlkey=rw96xaib9v0t0v97l3yumvn0v&dl=0

AlexPresso commented 1 year ago

I made a fix attempt in the linked PR (#102) , could you try to use the following procedure to test it please:

If you still have an issue please run the issue-report tool and post the result here again

Gargaj commented 1 year ago

Seems to be working on the few I tried! If I run into issues I'll come back.

AlexPresso commented 1 year ago

Alright, thank you for testing :)