cibrandocampo / synology-transcoding

Transcoding optimizations for Synology Photo
MIT License
8 stars 0 forks source link

Doesn't seem to work #14

Open seemebreakthis opened 3 weeks ago

seemebreakthis commented 3 weeks ago

I tried doing a test run with "python video_quality_enhancer.py" (after doing the video_quality_enhancer.conf change). I see something wrong with the output then I force quit the python script.

2024-06-09 01:40:16 INFO     video_transcode. Starting transcoding (1/2) for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_2163.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_2163.mp4/SYNOPHOTO_FILM_M.mp4
ffmpeg: i965_encoder.c:1692: intel_enc_hw_context_init: Assertion `encoder_context->mfc_context' failed.
2024-06-09 01:40:35 INFO     video_transcode. Finished transcoding (1/2) for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_2163.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_2163.mp4/SYNOPHOTO_FILM_M.mp4
2024-06-09 01:40:40 INFO     video_transcode. Starting transcoding (2/2) for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_2163.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_2163.mp4/SYNOPHOTO_FILM_M.mp4
ffmpeg: i965_encoder.c:1692: intel_enc_hw_context_init: Assertion `encoder_context->mfc_context' failed.
2024-06-09 01:40:54 WARNING  video_transcode. Transcoding proccess for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_2163.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_2163.mp4/SYNOPHOTO_FILM_M.mp4
2024-06-09 01:40:54 INFO     video_transcode. Starting Single-pass for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_2163.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_2163.mp4/SYNOPHOTO_FILM_M.mp4
ffmpeg: i965_encoder.c:1692: intel_enc_hw_context_init: Assertion `encoder_context->mfc_context' failed.
2024-06-09 01:41:09 WARNING  video_transcode. Failed Single-pass for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_2163.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_2163.mp4/SYNOPHOTO_FILM_M.mp4
2024-06-09 01:41:28 INFO     video_transcode. Starting transcoding (1/2) for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_2163.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_2163.mp4/SYNOPHOTO_FILM_H.mp4
ffmpeg: i965_encoder.c:1692: intel_enc_hw_context_init: Assertion `encoder_context->mfc_context' failed.
2024-06-09 01:41:43 INFO     video_transcode. Finished transcoding (1/2) for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_2163.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_2163.mp4/SYNOPHOTO_FILM_H.mp4
2024-06-09 01:41:48 INFO     video_transcode. Starting transcoding (2/2) for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_2163.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_2163.mp4/SYNOPHOTO_FILM_H.mp4
ffmpeg: i965_encoder.c:1692: intel_enc_hw_context_init: Assertion `encoder_context->mfc_context' failed.
2024-06-09 01:42:02 WARNING  video_transcode. Transcoding proccess for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_2163.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_2163.mp4/SYNOPHOTO_FILM_H.mp4
2024-06-09 01:42:02 INFO     video_transcode. Starting Single-pass for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_2163.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_2163.mp4/SYNOPHOTO_FILM_H.mp4
ffmpeg: i965_encoder.c:1692: intel_enc_hw_context_init: Assertion `encoder_context->mfc_context' failed.
2024-06-09 01:42:15 WARNING  video_transcode. Failed Single-pass for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_2163.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_2163.mp4/SYNOPHOTO_FILM_H.mp4
2024-06-09 01:42:15 INFO     check_if_videos_needs_transcoding. /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_3191.mp4/SYNOPHOTO_FILM_M.mp4 needs to be transcoded
2024-06-09 01:42:15 INFO     check_if_videos_needs_transcoding. /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_3191.mp4/SYNOPHOTO_FILM_H.mp4 needs to be transcoded
2024-06-09 01:42:29 INFO     video_transcode. Starting transcoding (1/2) for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_3191.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_3191.mp4/SYNOPHOTO_FILM_M.mp4
ffmpeg: i965_encoder.c:1692: intel_enc_hw_context_init: Assertion `encoder_context->mfc_context' failed.
2024-06-09 01:42:44 INFO     video_transcode. Finished transcoding (1/2) for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_3191.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_3191.mp4/SYNOPHOTO_FILM_M.mp4
2024-06-09 01:42:49 INFO     video_transcode. Starting transcoding (2/2) for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_3191.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_3191.mp4/SYNOPHOTO_FILM_M.mp4
ffmpeg: i965_encoder.c:1692: intel_enc_hw_context_init: Assertion `encoder_context->mfc_context' failed.
2024-06-09 01:43:04 WARNING  video_transcode. Transcoding proccess for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_3191.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_3191.mp4/SYNOPHOTO_FILM_M.mp4
2024-06-09 01:43:04 INFO     video_transcode. Starting Single-pass for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_3191.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_3191.mp4/SYNOPHOTO_FILM_M.mp4
ffmpeg: i965_encoder.c:1692: intel_enc_hw_context_init: Assertion `encoder_context->mfc_context' failed.
2024-06-09 01:43:20 WARNING  video_transcode. Failed Single-pass for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_3191.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_3191.mp4/SYNOPHOTO_FILM_M.mp4
2024-06-09 01:43:34 INFO     video_transcode. Starting transcoding (1/2) for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_3191.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_3191.mp4/SYNOPHOTO_FILM_H.mp4
ffmpeg: i965_encoder.c:1692: intel_enc_hw_context_init: Assertion `encoder_context->mfc_context' failed.
2024-06-09 01:43:48 INFO     video_transcode. Finished transcoding (1/2) for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_3191.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_3191.mp4/SYNOPHOTO_FILM_H.mp4
2024-06-09 01:43:53 INFO     video_transcode. Starting transcoding (2/2) for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_3191.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_3191.mp4/SYNOPHOTO_FILM_H.mp4
ffmpeg: i965_encoder.c:1692: intel_enc_hw_context_init: Assertion `encoder_context->mfc_context' failed.
2024-06-09 01:44:07 WARNING  video_transcode. Transcoding proccess for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_3191.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_3191.mp4/SYNOPHOTO_FILM_H.mp4
2024-06-09 01:44:07 INFO     video_transcode. Starting Single-pass for: /volume1/photo/my_photo/00 - Miscellaneous/2016/IMG_3191.mp4 to /volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_3191.mp4/SYNOPHOTO_FILM_H.mp4
^C^C^C^C^Cffmpeg: i965_encoder.c:1692: intel_enc_hw_context_init: Assertion `encoder_context->mfc_context' failed.

When I do an 'ls -la' afterwards I see 0 byte files (i.e. some of my transcoded videos are now corrupted):

root@DS220:/volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_2163.mp4# ls -la
total 616
drwxrwxrwx+ 1 PhotoStation PhotoStation   2872 Jan 20 12:31 .
drwxrwxrwx+ 1 root         root          29400 Jan 20 14:05 ..
drwxrwxrwx+ 1 root         root           1040 Jan 20 12:09 @eaDir
-rwxrwxrwx+ 1 root         root            473 Jan 20 11:25 SYNOINDEX_MEDIA_INFO
-rwxrwxrwx+ 1 root         root             80 Jan 20 12:31 SYNOINDEX_VIDEO_METADATA
lrwxrwxrwx  1 root         root             18 Oct 13  2020 SYNOPHOTO_FILM_H264.mp4 -> ../../IMG_2163.mp4
-rwxrwxrwx  1 PhotoStation PhotoStation      0 Jun  9 01:42 SYNOPHOTO_FILM_H.mp4
-rwxrwxrwx  1 PhotoStation PhotoStation 158528 Oct 13  2020 SYNOPHOTO_FILM_L.mp4
-rwxrwxrwx  1 PhotoStation PhotoStation      0 Jun  9 01:41 SYNOPHOTO_FILM_M.mp4
-rwxrwxrwx  1 PhotoStation PhotoStation 144564 Oct 13  2020 SYNOPHOTO_FILM_MOBILE.mp4
-rwxrwxrwx  1 PhotoStation PhotoStation  24779 Oct 13  2020 SYNOPHOTO_THUMB_B.jpg
-rwxrwxrwx  1 PhotoStation PhotoStation  72019 Oct 13  2020 SYNOPHOTO_THUMB_L.jpg
-rwxrwxrwx  1 PhotoStation PhotoStation  20455 Oct 13  2020 SYNOPHOTO_THUMB_M.jpg
-rwxrwxrwx  1 PhotoStation PhotoStation   2214 Oct 13  2020 SYNOPHOTO_THUMB_S.jpg
-rw-r--r--  1 root         root          13380 Jan 20 12:31 SYNOPHOTO_THUMB_SM.jpg
-rwxrwxrwx  1 PhotoStation PhotoStation  72019 Oct 13  2020 SYNOPHOTO_THUMB_XL.jpg
root@DS220:/volume1/photo/my_photo/00 - Miscellaneous/2016/@eaDir/IMG_2163.mp4#

... Doesn't work for me. Let me know please what info you need, if you would like to troubleshoot.

seemebreakthis commented 3 weeks ago

According to https://superuser.com/questions/1462402/ffmpeg-not-working-using-h264-vaapi, this could solve the problem:

apt install intel-media-va-driver-non-free i965-va-driver-shaders

I think it is worth a try, but I have no clue how to add this line to the temporarily created docker container before ffmpeg begins decoding / encoding.

seemebreakthis commented 3 weeks ago

I made this workaround image which seems to be working for me so far. What I did was:

  1. Created this dockerfile:
# Use the original image as the base image
FROM jrottenberg/ffmpeg:5-vaapi

# Update the package list and install the required packages
RUN apt-get update && apt-get install -y intel-media-va-driver-non-free i965-va-driver-shaders && apt-get clean
  1. Run this command docker build -t sam/ffmpeg:5-vaapi .
  2. So now I have this new image sam/ffmpeg:5-vaapi, with the desired packages installed.
  3. Change video_quality_enhancer.conf, and replace jrottenberg/ffmpeg:5-vaapi with sam/ffmpeg:5-vaapi
  4. python video_quality_enhancer.py

So far it seems to be transcoding ok on my DS-220+. Not finished yet, because there are lots of video files to be processed. But it is looking good so far.

Hopefully there will be a permanent fix based on what I did above.