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] Thumbnail generation is not possible in VideoStation. #61

Closed carr0t2 closed 1 year ago

carr0t2 commented 1 year ago

System details

Describe the bug Thumbnail generation is not possible in VideoStation.

ffmpeg.log (containing the ffmpeg-wrapper execution logs)

[20:16:48] [INFO] ========================================[start ffmpeg 24795]
[20:16:48] [INFO] DEFAULT_ARGS: -timelimit 240 -an -i /volume4/xxxx.mp4 -ss 3 -vframes 1 -vf scale=size=hd480:force_original_aspect_ratio=decrease -f mjpeg -y /volume4/xxxx.mp4/SYNOVIDEO_TEMP.jpg
[20:16:50] [INFO] ========================================[end ffmpeg 24795]
carr0t2 commented 1 year ago

Because the exit value of the "wrapper" is 1. The synovideoindexd process will then assume that ffmpeg failed to generate the thumbnail and delete it.

The error in the log file looks like this:

synovideoindexd[310]: video_screenshot.cpp:202 Fail to generate screenshot

Detailed analysis is as follows 241 lines attempt to generate thumbnails. image

After concatenating string parameters earlier, on line 100, the command is executed. Since the exit value is 1, it enters the if statement, and the actually generated thumbnail that was successful is unlinked.

image

The effect of this is reflected in the strace log as follows:

20:16:56.849761 rt_sigaction(SIGCHLD, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fb234ddbaf0}, 8) = 0 <0.000043>
20:16:56.849897 clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fb2364200d0) = 24996 <0.001125>
20:16:56.851173 wait4(24996, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 24996 <0.701854>
20:16:57.553368 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=24996, si_uid=0, si_status=1, si_utime=0, si_stime=0} ---
20:16:57.553595 unlink("/volume4/xxxx.mp4/SYNOVIDEO_TEMP.jpg") = 0 <0.000364>
20:16:57.554222 sendto(5, "<11> 20:16:57 synovideoind"..., 180, MSG_NOSIGNAL, NULL, 0) = 180 <0.000114>
20:16:57.554793 access("/volume4/xxxx.mp4/SYNOVIDEO_TEMP.jpg", F_OK) = -1 ENOENT (No such file or directory) <0.000203>
AlexPresso commented 1 year ago

Oh waow ! Thank you very much for the detailed research and the PR man, great work !