mirror of
https://github.com/immich-app/immich.git
synced 2026-03-02 22:57:45 -05:00
Corrupt transcoded video with rkmpp decoder. #4154
Closed
opened 2026-02-20 03:01:03 -05:00 by deekerman
·
61 comments
No Branch/Tag specified
main
renovate/typescript-projects
release/next
renovate/github-actions
chore/translations
push-nwxlpmyzkyrl
push-wzwotsylzylq
push-zpwsovysllvn
push-zunuwtznrlpm
renovate/opentofu-1.x
renovate/node
push-rsywxvptwxuv
renovate/prom-prometheus
renovate/docker.io-valkey-valkey-9
push-suusrsrnmzrp
push-xyozownmuwqp
csp-policy
uhthomas/fix-mobile-video-state
uhthomas/fix-mobile-hero-height
feat/use-native-clients
uhthomas/chore-mobile-simplify-scroll
feat/mobile-edit-3-mobile-sync-handling
feat/panorama-tiles
refactor/zod-migration
fix/maintenance-reload
refactor/restores-file-interceptor
uhthomas/fix-mobile-inconsistent-asset-detials-background
postgres-socketio
claude/auto-screenshot-web-changes-Y7efI
visual-review/pr-26535
push-lvyturrtwkrq
feat/notification
feat/library-offline-stats
feat/checksum-algorithm-indicator
feat/library-offline-count
uhthomas/feat-mobile-search-results
fix/bring-back-globalkeys
fix/map-webgl-error
feat/mobile-ocr
feat/custom-date-range
fix/mobile-video-aspect-ratio
fix/ml-ocr-batch-size
fix/timeline-rtl
feat/integrity-checks-izzy
uhthomas/fix-mobile-search-results
renovate/flutter
uhthomas/feat-sort-smart-search
renovate/github-cqlabs-homebrew-dcm-1.x
feat/video-player
feat/mobile-editing
refactor/remove-replace-with-upload
uhthomas/chore-mobile-maplibre
uhthomas/mobile-fix-asset-details-album-pop
feat/crawl-wrapper
feat/open-in-browser
push-skvzqoozqkpl
feat/edit-filters
fix/locale-settings-desc
feat/pg-queue
refactor/asset-upload
renovate/connectivity_plus-7.x
better-project-structure
uhthomas/mobile-feat-asset-viewer-details
fix/ml-rocm-build
fix/25803
feat/asset-file-apis
midzelis/wip
feature/bottom-buttons-order
sqlite_thumbs
fix-keep-correct-ios-shared-album-asset
fix-memory-generation-and-display
push-vpxwmwwxwnvw
fix-migration-width-height
revert/prettier-translations
shared-deep-link-handler
feat/thumbnail-native-clients
feat/platform-clients
fix/foreground-cloud-sync
filter-by-person
feat/csp
refactor/sidebar
fix/disable-editing
fix/view-timeline-deeplink
image-zoom-on-slow-connection
fix/merged-edited-assets
open-api-fix
feat/create-job-with-dto
use-toast-primary
feat/vitest-4
feat/ios-fastlane-match
match-signing
fix-update-time-update-timeline
feat/modal-routes
feature/mobile-view-asset-owner
feat/system-settings
feature/show-activity-count
better-info-in-asset-viewer
fix/all-people-count
feat/location-favorites
feature/rearrange-buttons-2
fix/download-storage-template
feat/kb-shortcuts-mobile
fix/people-count
push-qolzzzzxrvvn
chore/originals-in-asset-files
feat/asset-size-columns
ben/tree-a11y
new-search-filter-ui
refactor/expectSelectedReadonly
refactor/mobile-grdb
push-qvuktpxmkknu
feat/mobile-native-local-sync
refactor/timeline_ops
fix/scrubber_end
feat/version.txt
feat/context-menus
feat/server-chunked-uploads
refactor/virtualsegment
refactor/rename_daymonth_groups
fix/restrict-android-bg-worker
feat/android-periodic-worker
fix-remote-sync-clean-up
refactor/timeline_move_ops
fix/timeline_split_selectable
feat/keyboard_actions_help_modal
feat/static_frontend
feat/notification-warnign-android
feat/plugins2
feat/plugins
test/create-workflow-token-action
fix/docs-force
debug/search-result-similarity
debug/cf-chunked-uploads
feat/eslint_rule
feat/search-filter-album/web
refactor/timeline_photostream
refactor/timelineasset_asset
feat/session-permissions
feat/timeline_photostream_assetnav
feat/timeline_minor_optimize
feat/timeline_perf_nocomp
feat/timeline_search_results_actions
feat/timeline_search_results_page
fix/timeline_padding
fix/timeline_search_reactivity_warnings
feat/timeline_scrollbar
feat/timeline_stream_withviewer
fix/timeline_back_forth_nav
refactor/timeline_photostream_component
fix/generated-files-checks
fix/locate-button-local
chore/base-image-mimalloc
refactor/timeline_assetlayout
refactor/timeline_selectable
refactor/timeline_aware_actions
refactor/timeline_monthsegment
feat/remove-old-pages
chore/deps-gradle
tmp_photostream
tmp/lcms
feat/mobile-dynamic-thumbnails
fix/mobile-finer-thumbnail-concurrency
refactor/timeline1
refactor/extract_photostream
refactor/rename_load_api
refactor/timeline2
refactor/timeline3
feat/multi-select-asset-viewer
feat-no-thumbhash-cache
refactor/asset_grid
feat/faster-access-checks
fix/18991
fix/19543
chore/temp-remove
fix/21419
feat/mobile-hdr-images
chore/update-mise-lockfile
feat/mise-server-checks
feat/mise-ci
feat/windows-2025
feat/dev_cli
refactor/mobile-migrate-clients
fix/map-theme
fix/require-checkbox
chore/use_swc
feat/efficient-thumbnail-decoding
refactor/mobile-thumbhash
refactor/mobile-thumbhash-new
feat/beta-background-upload
fix/beta-timeline-memories-setting
fix/failed-uploads-not-removed
feat/mobile-shared-album
feat/groups
drift-map-page
drift-auth-user-sync
fix/disable-memory
feat/add-to-album-action
edit-date-time-action
drift-people-page
sqlite-remove-isIn
chore/required-reviewers
refact/asset-manager
fix/folder-sort
pnpm
feat/widget-multiple-server-urls
chore/medium-tests-dbname
fix/web-no-iterator-find
fix/map-pan-interruption
track-livephotos
timeline_events
chore/oxlint-migration
feat/maintenance-worker
feat/dav
chore/demo-snapshot
refactor/server-side-dedupe
feat/integrity-checks
dev/recognition-eval
lighter_buckets_test
perf/postgres-queue
postgres-queue
focus_rings
refactor/web-stores-1
refactor/add-to-taken
feat/sort-places
vet
tmp/demo-snapshot-preview
fix/server-migration-file-extension
fix/asset-update-race-condition
rknn-toolkit-lite2
refactor/mobile-split-up-search-page
feature/Add-rocm-support-for-machine-learning
feat/rocm
chore/async-hash-file
feat/shared-link-view-count
feat/rotation
feat/graphql
feat/job-ids
feat/ignore-library-permission-error
feat/docker-compose-builder
feat/kysely-typeorm
mobile/onboarding
no-video-player
fix/server-qsv-output-format
chore/server-geodata-tweaks
mobile/native-video-player-no-hero
feat/xxhash
fix/docs-concurrency
feat/local-tileserver
refactor/exif-orientation
original-path-infix
refactor/mobile/login-form-1
feat/server-editor-endpoints
fix/server-qsv-vbr
fix-mobile-db-problems
feat/ml-armnn-conversion
feat/mobile/backup-with-album-info
feat/fast-initial-sync-1
chore/handle-output_dims
feat/unassign-faces
feat/shortcuts-on-asset-grid
feat/capacitor-mobile-app-poc
feat/server-nvenc-hw-decoding
fix/mobile-fetch-non-archive
web/automation-ui
feat/mobile-server-endpoint-save-dropdown
object-storage
feat/memories-animations
dev/metrics
ml/tflite
feat/ml-export-cli
v2.5.6
v2.5.5
v2.5.4
v2.5.3
v2.5.2
v2.5.1
v2.5.0
v2.4.1
v2.4.0
v2.3.1
v2.3.0
v2.2.3
v2.2.2
v2.2.1
v2.2.0
v2.1.0
v2.0.1
v2.0.0
v1.144.1
v1.144.0
v1.143.1
v1.143.0
v1.142.1
v1.142.0
v1.141.1
v1.141.0
v1.140.1
v1.140.0
v1.139.4
v1.139.3
v1.139.2
v1.139.1
v1.139.0
v1.138.1
v1.138.0
v1.137.3
v1.137.2
v1.137.1
v1.137.0
v1.136.0
v1.135.3
v1.135.2
v1.135.1
v1.135.0
v1.134.0
v1.133.1
v1.133.0
v1.132.3
v1.132.2
v1.132.1
v1.132.0
v1.131.3
v1.131.2
v1.131.1
v1.131.0
v1.130.3
v1.130.2
v1.130.1
v1.130.0
v1.129.0
v1.128.0
v1.127.0
v1.126.1
v1.126.0
v1.125.7
v1.125.6
v1.125.5
v1.125.4
v1.125.3
v1.125.2
v1.125.1
v1.125.0
v1.124.2
v1.124.1
v1.124.0
v1.123.0
v1.122.3
v1.122.2
v1.122.1
v1.122.0
v1.121.0
v1.120.2
v1.120.1
v1.120.0
v1.119.1
v1.119.0
v1.118.2
v1.118.1
v1.118.0
v1.117.0
v1.116.2
v1.116.1
v1.116.0
v1.115.0
v1.114.0
v1.113.1
v1.113.0
v1.112.1
v1.112.0
v1.111.0
v1.110.0
v1.109.2
v1.109.1
v1.109.0
v1.108.0
v1.107.2
v1.107.1
v1.107.0
v1.106.4
v1.106.3
v1.106.2
v1.106.1
v1.106.0
v1.105.1
v1.105.0
v1.104.0
v1.103.1
v1.103.0
v1.102.3
v1.102.2
v1.102.1
v1.102.0
v1.101.0
v1.100.0
v1.99.0
v1.98.2
v1.98.1
v1.98.0
v1.97.0
v1.96.0
v1.95.1
v1.95.0
v1.94.1
v1.94.0
v1.93.3
v1.93.2
v1.93.1
v1.93.0
v1.92.1
v1.92.0
v1.91.4
v1.91.3
v1.91.2
v1.91.1
v1.91.0
v1.90.2
v1.90.1
v1.90.0
v1.89.0
v1.88.2
v1.88.1
v1.88.0
v1.87.0
v1.86.0
v1.85.0
v1.84.0
v1.83.0
v1.82.1
v1.82.0
v1.81.1
v1.81.0
v1.80.0
v1.79.1
v1.79.0
v1.78.1
v1.78.0
v1.77.0
v1.76.1
v1.76.0
v1.75.2
v1.75.1
v1.75.0
v1.74.0
v1.73.0
v1.72.2
v1.72.1
v1.72.0
v1.71.0
v1.70.0
v1.69.0
v1.68.0
v1.67.2
v1.67.1
v1.67.0
v1.66.1
v1.66.0
v1.65.0
v1.64.0
v1.63.2
v1.63.1
v1.63.0
v1.62.1
v1.62.0
v1.61.0
v1.60.0
v1.59.1
v1.59.0
v1.58.0
v1.57.1
v1.57.0
v1.56.2
v1.56.1
v1.56.0
v1.55.1
v1.55.0
v1.54.1
v1.54.0
v1.53.0
v1.52.1
v1.52.0
v1.51.2
v1.51.1
v1.51.0
v1.50.1
v1.50.0
v1.49.0
v1.48.1
v1.48.0
v1.47.3
v1.47.2
v1.47.1
v1.47.0
v1.46.1
v1.46.0
v1.45.0
v1.44.0
v1.43.1
v1.43.0
v1.42.0_65-dev
v1.41.1_64-dev
v1.41.0_64-dev
v1.40.1_63-dev
v1.40.0_63-dev
v1.39.0_61-dev
v1.38.2_60-dev
v1.38.1_60-dev
v1.38.0_60-dev
v1.37.0_58-dev
v1.36.2_56-dev
v1.36.1_55-dev
v1.36.0_55-dev
v1.35.0_54-dev
v1.34.0_53-dev
v1.33.1_52-dev
v1.33.0_52-dev
v1.32.1_51-dev
v1.32.0_50-dev
v1.31.1_49-dev
v1.31.0_49-dev
v1.30.2_48-dev
v1.30.0_46-dev
v1.29.6_45-dev
v1.29.6_44-dev
v1.29.5_44-dev
v1.29.4_44-dev
v1.29.3_43-dev
v1.29.2_43-dev
v1.29.1_43-dev
v1.29.0_42-dev
v1.28.4_41-dev
v1.28.4_42-dev
v1.28.3_41-dev
v1.28.2_40-dev
v1.28.1_39-dev
v1.28.0_38-dev
v1.27.0_37-dev
v1.26.0_36-dev
v1.25.0_35-dev
v1.24.0_34-dev
v1.23.0_33-dev
v1.22.0_32-dev
v1.21.1_31-dev
v1.21.0_31-dev
v1.20.3_30-dev
v1.20.2_30-dev
v1.20.1_30-dev
v1.20.0_30-dev
v1.19.1_29-dev
v1.19.0_29-dev
v1.18.0_27-dev
v1.17.0_25-dev
v1.16.0_23-dev
v1.15.1_21-dev
v1.15.0_21-dev
v1.14.0_21-dev
v1.13.0_20-dev
v1.12.0_18-dev
v1.11.0_17-dev
v1.10.0_15-dev
v1.9.1_14-dev
v1.9.0_13-dev
v1.8.0_12-dev
v1.7.0_11-dev
v1.6.0_10-dev
v1.5.1+9-dev
v1.5.0+8-dev
v1.4.0+7-dev
v1.4.0+6-dev
v1.4.0-dev
v1.3.0-dev
v1.3.1-dev
v0.6-dev
v0.5-dev
v0.4-dev
v0.3-dev
v0.2-dev
first-android-release
Labels
Clear labels
accessibility
changelog:enhancement
changelog:security
changelog:skip
changelog:translation
cli
date-time
dependencies
documentation
external-library
format
good first issue
mobile-beta
mobile-beta
mobile-beta
needs-answer
nice to have
sharing
tech-debt
📱mobile
🖥️web
🗄️server
🧠machine-learning
No labels
accessibility
changelog:enhancement
changelog:security
changelog:skip
changelog:translation
cli
date-time
dependencies
documentation
external-library
format
good first issue
mobile-beta
mobile-beta
mobile-beta
needs-answer
nice to have
sharing
tech-debt
📱mobile
🖥️web
🗄️server
🧠machine-learning
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
starred/immich#4154
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kaaku3 on GitHub (Oct 24, 2024).
The bug
X265 4K videos, transcoded down to 720p x265 using rkmmp hardware accelerated encoding and decoding are sometimes corrupted causing looped playback and strange colours and artifacts when played back.
Video seem fine with HW decoding disabled.
It does not happen every time and is inconsistent but happens often.
The OS that Immich Server is running on
Armbian Bookworm
Version of Immich Server
V1.118.2
Version of Immich Mobile App
V1.118.0
Platform with the issue
Your docker-compose.yml content
Your .env content
Reproduction steps
...
Relevant log output
No response
Additional information
No response
@kaaku3 commented on GitHub (Oct 31, 2024):
Hi, Are you sure this is fixed?
You mentioned in #13785 that HW decoding is untested.
The problem I reported only affects HW decoding.
@mertalev commented on GitHub (Oct 31, 2024):
I tested this separately and I think it's caused by this issue. You're most likely seeing tone-mapping artifacts that will be fixed by setting the peak luminance explicitly. Since the linked PR does just this, it should fix the issue.
@kaaku3 commented on GitHub (Oct 31, 2024):
Thankyou very much for getting back to me, I appreciate all the hard work.
@kaaku3 commented on GitHub (Nov 7, 2024):
HI, Unfortunately I do still have the same problem on hardware decoded transcoded videos in v1.120.
It has significantly improved but is still happening in low light videos
@mertalev commented on GitHub (Nov 7, 2024):
Hmm, I guess peak=100 (1000 nits) is off for certain videos. Can you share the output of
mediainfo <path>orffprobe -show_streams <path>for an affected video? Maybe we can use a different number based on certain metadata.@mertalev commented on GitHub (Nov 7, 2024):
Also, are the videos experiencing issues in 1.120.0 the same videos that looked corrupt in earlier versions? Or do different videos look corrupt now?
@kaaku3 commented on GitHub (Nov 8, 2024):
Media Info
General
Complete name : PXL_20241105_062315977.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/mp41)
File size : 54.8 MiB
Duration : 7 s 250 ms
Overall bit rate : 63.4 Mb/s
Frame rate : 59.859 FPS
Encoded date : 2024-11-05 06:23:25 UTC
Tagged date : 2024-11-05 06:23:25 UTC
xyz : +35.6247+139.4298/
com.android.manufacturer : Google
com.android.model : Pixel 6a
Video
ID : 3
Format : HEVC
Format/Info : High Efficiency Video Coding
Format profile : Main@L5.1@High
Codec ID : hvc1
Codec ID/Info : High Efficiency Video Coding
Duration : 7 s 250 ms
Bit rate : 63.1 Mb/s
Width : 3 840 pixels
Height : 2 160 pixels
Display aspect ratio : 16:9
Rotation : 90°
Frame rate mode : Variable
Frame rate : 59.859 FPS
Minimum frame rate : 59.367 FPS
Maximum frame rate : 60.362 FPS
Real frame rate : 60.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Bits/(Pixel*Frame) : 0.127
Stream size : 54.5 MiB (100%)
Title : VideoHandle
Language : English
Encoded date : 2024-11-05 06:23:25 UTC
Tagged date : 2024-11-05 06:23:25 UTC
Color range : Full
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
Codec configuration box : hvcC
Audio
ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 7 s 243 ms
Bit rate mode : Constant
Bit rate : 192 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Frame rate : 46.875 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 170 KiB (0%)
Title : SoundHandle
Language : English
Encoded date : 2024-11-05 06:23:25 UTC
Tagged date : 2024-11-05 06:23:25 UTC
Other
Type : meta
Duration : 7 s 250 ms
Bit rate mode : Variable
@mertalev commented on GitHub (Nov 8, 2024):
Hmm, it doesn't seem like this is an HDR video. Could you follow these steps:
docker logs immich_serverffmpegcommand (has/usr/bin/ffmpegin it)I'm curious to see what the specific command is to see where this is going wrong.
@kaaku3 commented on GitHub (Nov 9, 2024):
I set log level to debug, but unfortunately i do not see ffmpeg anything.
I tried verbose and the only thing I see that is remotely related in the log is:
[Nest] 17 - 11/09/2024, 1:18:31 PM VERBOSE [Api:LoggingInterceptor~p0aolibi] {"assetIds":[],"name":"transcode-video"}
@kaaku3 commented on GitHub (Nov 9, 2024):
Disregard that, the problem was the option "refresh encoded videos" is not re-encoding the video... maybe i misunderstood the meaning of that feature.
I made a new video in low light and uploaded it with hardware decoding on, the result was corruption towards the end of the file.
ffmpeg -n 10 /usr/bin/ffmpeg -hwaccel rkmpp -hwaccel_output_format drm_prime -afbc rga -noautorotate -i upload/library/Kirk/2024/2024-11-09/PXL_20241109_133516985.mp4 -y -c:v hevc_rkmpp -c:a aac -movflags faststart -fps_mode passthrough -map 0:2 -map 0:1 -g 256 -tag:v hvc1 -v verbose -vf scale_rkrga=720:-2:format=nv12:afbc=1 -level 153 -rc_mode CQP -qp_init 28 upload/encoded-video/c160480f-610d-42d9-8cea-829489f5a58e/f2/b0/f2b017d0-38f9-4331-8f71-d7c71e48b0c2.mp4
I then renamed the file and reuploaded it with hardware decoding off and the resulting file was fine.
ffmpeg -n 10 /usr/bin/ffmpeg -i upload/library/Kirk/2024/2024-11-09/reupload.mp4 -y -c:v hevc_rkmpp -c:a aac -movflags faststart -fps_mode passthrough -map 0:2 -map 0:1 -g 256 -tag:v hvc1 -v verbose -vf scale=720:-2 -level 153 -rc_mode CQP -qp_init 28 upload/encoded-video/c160480f-610d-42d9-8cea-829489f5a58e/8d/4e/8d4e5afc-9692-4169-b813-67ba68b96fdd.mp4
Media info for file
General
Complete name : Kirk/2024/2024-11-09/reupload.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/mp41)
File size : 78.3 MiB
Duration : 10 s 515 ms
Overall bit rate : 62.5 Mb/s
Frame rate : 59.536 FPS
Movie name : Re-upload
Encoded date : 2024-11-09 13:35:28 UTC
Tagged date : 2024-11-09 13:35:28 UTC
xyz : +35.6879+139.4576/
com.android.model : Pixel 7a
com.android.manufacturer : Google
Video
ID : 3
Format : HEVC
Format/Info : High Efficiency Video Coding
Format profile : Main@L6@Main
Codec ID : hvc1
Codec ID/Info : High Efficiency Video Coding
Duration : 10 s 515 ms
Bit rate : 62.2 Mb/s
Width : 3 840 pixels
Height : 2 160 pixels
Display aspect ratio : 16:9
Rotation : 90°
Frame rate mode : Variable
Frame rate : 59.536 FPS
Minimum frame rate : 42.959 FPS
Maximum frame rate : 96.774 FPS
Real frame rate : 60.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Bits/(Pixel*Frame) : 0.126
Stream size : 78.0 MiB (100%)
Language : English
Encoded date : 2024-11-09 13:35:28 UTC
Tagged date : 2024-11-09 13:35:28 UTC
Color range : Full
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
Codec configuration box : hvcC
Audio
ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 10 s 505 ms
Bit rate mode : Constant
Bit rate : 192 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Frame rate : 46.875 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 246 KiB (0%)
Language : English
Encoded date : 2024-11-09 13:35:28 UTC
Tagged date : 2024-11-09 13:35:28 UTC
Other
Type : meta
Duration : 10 s 515 ms
Bit rate mode : Variable
I think you are right they are not HDR, but with the latest update corruption only seems to happen in low light videos, where as before the update it seemed more random.
edit. Just ran a few tests and the artifacts and problems seem to happen when in low light but then a strong light source appears in the video, causing looped video, artifacts and strange colours.
@mertalev commented on GitHub (Nov 9, 2024):
In the transcoding settings under Advanced, could you set the keyframe interval to 60? I wonder if that has an effect here.
@kaaku3 commented on GitHub (Nov 9, 2024):
Wow yes, its seems fine with "Maximum keyframe interval" set to 60, thank you so much.
Is it bad to keep it at 60 as opposed to auto?
@mertalev commented on GitHub (Nov 9, 2024):
It will make the videos very slightly bigger, but otherwise no downside as far as I know.
@kaaku3 commented on GitHub (Nov 9, 2024):
Ok, thankyou.
keeping the file size down was the reason i'm transcoding at all, as my mobile data plan is slow sometimes.
Not sure if it's related but i just noticed a very very thin line at the top and bottom of the video that is not there when I use software decoding.
@mertalev commented on GitHub (Nov 9, 2024):
The default in your case is 256, for reference. Can you try setting it to, say, 128? I'm thinking of changing the default for RKMPP to remedy this, but also trying to minimize the impact to file size.
@mertalev commented on GitHub (Nov 9, 2024):
cc @nyanmisaka if you have any insight into what's causing this behavior
@kaaku3 commented on GitHub (Nov 9, 2024):
After deleting and re-uploading the same to files one a dark video and one bright.
with 60 still sometimes is causing an issue on both bright and dark video.
128 was very bad.
Haven't seen a problem with it set to 32 after a few uploads.
The line I mentioned only affects hardware decoded videos and only visible on the android mobile app, not on web.
@kaaku3 commented on GitHub (Nov 9, 2024):
Since software decode is working fine with rkmpp hardware encode on its defaults, is there not any settings to play with on the hardware decode side?
Just after some googling it seems not everyone is getting perfect results with ffmpeg and drm_prime, could that be the problem?
The hardware decoder or ffmpegs compatibility with drm_prime? I don't really understand any of this but is there an alternative to drm_prime with rkmpp?
@mertalev commented on GitHub (Nov 9, 2024):
A max of 32 for a 60 FPS video is a keyframe roughly every 0.5s. This is okay, but I think it's the lowest that's reasonable to use.
What's particularly weird is that this is an encoding setting - it shouldn't be fixed by using software decoding. It's a combination of the frames being outputted by hardware decoding and the keyframe interval that's causing this issue.
I think drm_prime is needed for good performance so filters can directly access the frames in the GPU without copying them.
@kaaku3 commented on GitHub (Nov 9, 2024):
I'd like to help in anyway I can but I'm not very knowledgeable but i can follow instructions, do any of the devs have access to an rkmpp device?
@kaaku3 commented on GitHub (Nov 9, 2024):
I hope it doesn't seem like i'm complaining about the issue too much, I understand you must be busy on other things.
I love immich and i'm just grateful that rkmpp encode works at all, otherwise i'd have to buy a more power hungry device.
@nyanmisaka commented on GitHub (Nov 9, 2024):
What’s the SoC model and rockchip linux kernel version? (uname -a)
Can u share a sample clip and the full ffmpeg command line?
I may have time to take a look tomorrow.
@mertalev commented on GitHub (Nov 9, 2024):
No worries! It's great that you're reporting on this so we know about it and can fix it.
I think the best option would be to open an issue in jellyfin-ffmpeg as I believe most/all of the RKMPP decoders, filters and encoders for FFmpeg are implemented by them. A zipped sample video would be particularly helpful.
@mertalev commented on GitHub (Nov 9, 2024):
According to OP, this command is problematic:
This command works fine:
And changing the first command to use
-g 32instead of-g 256also works fine.Also, it seems there's a line at the top and bottom of the video when hardware decoding that doesn't happen with software decoding. I think this happens with
-g 32as well, but I'm not sure.@kaaku3 commented on GitHub (Nov 9, 2024):
uname -a
Linux immich-server 5.10.160-legacy-rk35xx #1 SMP Wed May 15 03:04:45 UTC 2024 aarch64 GNU/Linux
Its actually a rk3588s.
This is my sample video of a messy (excuse the mess) dark room that constantly causes issues.
2 files one with -g256 and one with -g 32.
In this instance -g 32 is also corrupt (up to this point -g32 was actually fine)
It seems hit or miss.
Thankyou for the command line noted above and the description is perfect, the line thing happens no matter the -g setting and is only visible in mobile app (android) maybe web viewer clips it off?
@w00tlarr commented on GitHub (Nov 10, 2024):
Hiya - running into this issue too but with Intel iGPU hardware acceleration. No issues encoding without iGPU.
@w00tlarr commented on GitHub (Nov 10, 2024):
Sample video after Intel iGPU hardware transcode using VAAPI or QuickSync.
https://github.com/user-attachments/assets/2c0df285-4d35-440c-94cf-ba0dae5469d1
@mertalev commented on GitHub (Nov 10, 2024):
Thanks for the report, but I don't think this is the same issue. The issue in question should be specific to RKMPP and (I think) fixed by this PR.
Please make a separate issue for this. You can set the log level to debug under Log Settings, then select
Refresh encoded videosfor an affected asset. Find the FFmpeg command used for this video in the server logs withdocker logs immich_server. In the issue, provide a sample video that causes this output and the accompanying FFmpeg command. Also include information about the OS, kernel version and specific processor.@kaaku3 commented on GitHub (Nov 10, 2024):
Great to hear a fix is on the way, thankyou so much.
(I was beginning to wonder if my chip was faulty)
@kaaku3 commented on GitHub (Nov 10, 2024):
So the reason it didn't happen with software decode was because it was slower?
@nyanmisaka commented on GitHub (Nov 11, 2024):
This is a completely different issue. Due to the driver/kernel rather than FFmpeg.
https://github.com/intel/media-driver/issues/1665
@nyanmisaka commented on GitHub (Nov 11, 2024):
The version in the link above should fix this artifact. You can try to install it manually and try again.
As for the green line I couldn't reproduce it in Chrome, PotPlayer, MPC-BE and even FFplay. So it is a problem specific to the built-in video player of your client platform.
720x406 hevc main

@kaaku3 commented on GitHub (Nov 11, 2024):
Thankyou, I'm not nearly versed enough with docker to update ffmpeg from source,I will wait for this to reach immich in an update.
The line, I was only about to reproduce in the immich app and only with files hardware decided and encoded.
You can see it here top left, and bottom middle in this screenshot

@nyanmisaka commented on GitHub (Nov 11, 2024):
It's best to switch to a different client and try again.
@nyanmisaka commented on GitHub (Nov 11, 2024):
For example, I cannot reproduce it on iPhone/iOS 17.
@kaaku3 commented on GitHub (Nov 11, 2024):
Ok, I will try it with the updated immich client, once the fix reaches it maybe it's not an issue anymore.
If it's still an issue I will open up an issue with the immich mobile app for android.
@w00tlarr commented on GitHub (Nov 11, 2024):
Thanks. Yeah it's that bug with the Intel Media Driver link you provided. Not sure if I should open a separate bug now as it seems to be a very very old issue with Proxmox + SRIOV + my new iPhone 16 with HDR videos. I just noticed this issue because of my new iPhone is recording HDR videos vs. my old iPhone XR.
Disabling the Tone-Mapping in the Immich Video Transcoding setting now works properly with hardware acceleration.
Anyways, sorry for hijacking this thread as it read like the same issue with me. I can open a new bug thread for tips to other folks, if needed.
@nyanmisaka commented on GitHub (Nov 12, 2024):
I don't have an Intel GPU that supports SRIOV at the moment (Intel ARC A380), you could try looking in the Intel repo to provide some context. But anyway this issue is not related to the downstream software, as the same FFmpeg commands run perfectly on the host.
@mertalev commented on GitHub (Nov 12, 2024):
@kaaku3 The bug fix for the RKMPP issue should be in 1.120.2. Can you try with that?
@kaaku3 commented on GitHub (Nov 12, 2024):
@mertalev that's great news, unfortunately my armbian server that immich was running went down last night.
I didn't touch anything, I don't know why.
You think publicly putting out a link to a video on immich was a bad idea?
I'm sure people have better things to do then mess with my server probably over thinking it.
Anyway I think I will need to put the immich backup restore feature to use today.
I will let you know if it's fixed as soon as i can.
Thankyou fire your help.
@mertalev commented on GitHub (Nov 12, 2024):
Sorry to hear that! There are lots of reasons it could fail, like power loss. But in general, make sure the server is hardened with a reverse proxy, fail2ban, etc. if you're exposing it to the internet. Definitely don't expose Immich (or any other service) directly.
@kaaku3 commented on GitHub (Nov 12, 2024):
I was using nginx, I will look into fail2ban too thankyou.
@kaaku3 commented on GitHub (Nov 13, 2024):
Hi, I started fresh. I had a lot of problems seems the newer kernel don't fully support hardware acceleration... i'm not quite sure.
I went with Joshua Rieks ubuntu with legacy kernel, that apparent everything should work out of the box, but i had problems with opencl. It seems to be working now, but I'm not 100%. Is there anyway from immich log to tell if its falling back to software encode. It doesn't seem to be going as fast as it was before. Also immich restore didn't work for me so i'm uploading everything.
this is the ffmpeg from immich log
ffmpeg -n 10 /usr/bin/ffmpeg -hwaccel rkmpp -hwaccel_output_format drm_prime -afbc rga -noautorotate -i upload/upload/0175ee76-7502-46c4-9685-08b06e26c9dc/a7/f0/a7f09b0f-653d-4920-8a95-ec929b890cc8.mp4 -y -c:v hevc_rkmpp -c:a aac -movflags faststart -fps_mode passthrough -map 0:2 -map 0:1 -g 256 -tag:v hvc1 -v verbose -vf scale_rkrga=720:-2:format=nv12:afbc=1 -level 153 -rc_mode CQP -qp_init 28 upload/encoded-video/0175ee76-7502-46c4-9685-08b06e26c9dc/f9/57/f9578312-e623-4a61-9667-607baed5a02e.mp4
anyway to tell from that that it isn't falling back to software?
I'm currently waiting on the problem file to be transcoded.
edit.
I there are errors
[Nest] 7 - 11/14/2024, 1:30:47 AM ERROR [Microservices:MediaRepository] handler_name : SoundHandle
vendor_id : [0][0][0][0]
Stream #0:20x3: Video: hevc (Main), 1 reference frame (hvc1 / 0x31637668), yuvj420p(pc, bt709, left), 3840x2160, 62337 kb/s, SAR 1:1 DAR 16:9, 59.86 fps, 59.94 tbr, 90k tbn (default)
Metadata:
creation_time : 2024-09-27T11:15:49.000000Z
handler_name : VideoHandle
vendor_id : [0][0][0][0]
[out#0/mp4 @ 0x3b53a170fc0] Adding streams from explicit maps...
[vost#0:0/hevc_rkmpp @ 0x3b53a1f2880] Created video stream from input stream 0:2
[hevc_rkmpp @ 0x3b53a2d1d80] Found SoC name from device-tree: 'rockchip,rk3588s-orangepi-5 rockchip,rk3588'
[hevc_rkmpp @ 0x3b53a2d1d80] Picked up an existing RKMPP hardware device
[aost#0:1/aac @ 0x3b53a1f0780] Created audio stream from input stream 0:1
Stream mapping:
Stream #0:2 -> #0:0 (hevc (hevc_rkmpp) -> hevc (hevc_rkmpp))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
[vost#0:0/hevc_rkmpp @ 0x3b53a1f2880] Starting thread...
[aost#0:1/aac @ 0x3b53a1f0780] Starting thread...
[vf#0:0 @ 0x3b53a127d40] Starting thread...
[af#0:1 @ 0x3b53a127e80] Starting thread...
[vist#0:2/hevc @ 0x3b53a050d80] [dec:hevc_rkmpp @ 0x3b53a2357c0] Starting thread...
[aist#0:1/aac @ 0x3b53a050c00] [dec:aac @ 0x3b53a237200] Starting thread...
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x3b53a080380] Starting thread...
Press [q] to stop, [?] for help
[hevc_rkmpp @ 0x3b53a2d1d80] Noticed an info change
[hevc_rkmpp @ 0x3b53a2d1d80] Configured with size: 3840x2160 | pix_fmt: drm_prime | sw_pix_fmt: nv12
[graph 0 input from stream 0:2 @ 0x3b542090300] w:3840 h:2160 pixfmt:drm_prime tb:1/90000 fr:60000/1001 sar:1/1 csp:bt709 range:pc
[Parsed_scale_rkrga_0 @ 0x3b542090240] w:3840 h:2160 fmt:nv12 -> w:1280 h:720 fmt:nv12
[graph 0 input from stream 0:2 @ 0x3b542090300] video frame properties congruent with link at pts_time: 0
[hevc_rkmpp @ 0x3b53a2d0500] Using input frames context (format drm_prime) with hevc_rkmpp encoder.
[hevc_rkmpp @ 0x3b53a2d0500] Rate Control mode is set to CQP
[hevc_rkmpp @ 0x3b53a2d0500] QP Init/Max/Min/Max_I/Min_I is set to 28/28/28/28/28
[hevc_rkmpp @ 0x3b53a2d0500] Tier is set to 1
[hevc_rkmpp @ 0x3b53a2d0500] Profile is set to MAIN
[hevc_rkmpp @ 0x3b53a2d0500] Level is set to 51
[hevc_rkmpp @ 0x3b53a2d0500] Configured with size: 1280x720 | pix_fmt: drm_prime | sw_pix_fmt: nv12
[graph_1_in_0:1 @ 0x3b540090300] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:stereo
Output #0, mp4, to 'upload/encoded-video/0175ee76-7502-46c4-9685-08b06e26c9dc/d1/6d/d16d540c-1124-4d90-847d-53fb08e97a41.mp4':
Metadata:
major_brand : isom
minor_version : 131072
compatible_brands: isomiso2mp41
com.android.capture.fps: 60.000000
location : +35.6813+139.5357/
location-eng : +35.6813+139.5357/
com.android.manufacturer: Google
com.android.model: Pixel 6a
encoder : Lavf61.1.100
Stream #0:0(eng): Video: hevc (Main), 1 reference frame (hvc1 / 0x31637668), drm_prime(pc, bt709, progressive, left), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 2000 kb/s, 59.94 fps, 60k tbn (default)
Metadata:
creation_time : 2024-09-27T11:15:49.000000Z
handler_name : VideoHandle
vendor_id : [0][0][0][0]
encoder : Lavc61.3.100 hevc_rkmpp
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, delay 1024, 128 kb/s (default)
Metadata:
creation_time : 2024-09-27T11:15:49.000000Z
handler_name : SoundHandle
vendor_id : [0][0][0][0]
encoder : Lavc61.3.100 aac
[out#0/mp4 @ 0x3b53a170fc0] Starting thread...
frame= 138 fps=0.0 q=-0.0 size= 1024KiB time=00:00:02.02 bitrate=4133.1kbits/s speed=4.06x
[hevc_rkmpp @ 0x3b53a2d0500] Failed to get key input frame from packet meta: -1
[vost#0:0/hevc_rkmpp @ 0x3b53a1f2880] Error submitting video frame to the encoder
[vost#0:0/hevc_rkmpp @ 0x3b53a1f2880] Error encoding a frame: Generic error in an external library
[vost#0:0/hevc_rkmpp @ 0x3b53a1f2880] Task finished with error code: -542398533 (Generic error in an external library)
[vost#0:0/hevc_rkmpp @ 0x3b53a1f2880] Terminating thread with return code -542398533 (Generic error in an external library)
[vf#0:0 @ 0x3b53a127d40] All consumers returned EOF
[vf#0:0 @ 0x3b53a127d40] Terminating thread with return code 0 (success)
[vist#0:2/hevc @ 0x3b53a050d80] [dec:hevc_rkmpp @ 0x3b53a2357c0] Decoder returned EOF, finishing
[vist#0:2/hevc @ 0x3b53a050d80] [dec:hevc_rkmpp @ 0x3b53a2357c0] Terminating thread with return code 0 (success)
[vist#0:2/hevc @ 0x3b53a050d80] All consumers of this stream are done
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x3b53a080380] Terminating thread with return code 0 (success)
[aist#0:1/aac @ 0x3b53a050c00] [dec:aac @ 0x3b53a237200] Decoder thread received EOF packet
[aist#0:1/aac @ 0x3b53a050c00] [dec:aac @ 0x3b53a237200] Decoder returned EOF, finishing
[aist#0:1/aac @ 0x3b53a050c00] [dec:aac @ 0x3b53a237200] Terminating thread with return code 0 (success)
[af#0:1 @ 0x3b53a127e80] Filtergraph returned EOF, finishing
[af#0:1 @ 0x3b53a127e80] All consumers returned EOF
[aost#0:1/aac @ 0x3b53a1f0780] Encoder thread received EOF
[aost#0:1/aac @ 0x3b53a1f0780] Terminating thread with return code 0 (success)
[out#0/mp4 @ 0x3b53a170fc0] All streams finished
[out#0/mp4 @ 0x3b53a170fc0] Terminating thread with return code 0 (success)
[af#0:1 @ 0x3b53a127e80] Terminating thread with return code 0 (success)
[mp4 @ 0x3b53a190e00] Starting second pass: moving the moov atom to the beginning of the file
[AVIOContext @ 0x3b53a237fc0] Statistics: 2787923 bytes read, 0 seeks
[AVIOContext @ 0x3b53a237c00] Statistics: 5582216 bytes written, 4 seeks, 25 writeouts
[out#0/mp4 @ 0x3b53a170fc0] Output file #0 (upload/encoded-video/0175ee76-7502-46c4-9685-08b06e26c9dc/d1/6d/d16d540c-1124-4d90-847d-53fb08e97a41.mp4):
[out#0/mp4 @ 0x3b53a170fc0] Output stream #0:0 (video): 283 frames encoded; 278 packets muxed (2720898 bytes);
[out#0/mp4 @ 0x3b53a170fc0] Output stream #0:1 (audio): 192 frames encoded (196608 samples); 193 packets muxed (66981 bytes);
[out#0/mp4 @ 0x3b53a170fc0] Total: 471 packets (2787879 bytes) muxed
[out#0/mp4 @ 0x3b53a170fc0] video:2657KiB audio:65KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.230928%
frame= 278 fps=272 q=-0.0 Lsize= 2729KiB time=00:00:04.12 bitrate=5425.4kbits/s speed=4.04x
[aac @ 0x3b53a2d2480] Qavg: 832.837
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x3b53a080380] Input file #0 (upload/upload/0175ee76-7502-46c4-9685-08b06e26c9dc/40/f9/40f9b5f3-8512-4058-9ffe-b71c12358bac.mp4):
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x3b53a080380] Input stream #0:1 (audio): 193 packets read (99038 bytes); 192 frames decoded; 0 decode errors (196608 samples);
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x3b53a080380] Input stream #0:2 (video): 303 packets read (39917376 bytes); 289 frames decoded; 0 decode errors;
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x3b53a080380] Total: 496 packets (40016414 bytes) demuxed
[AVIOContext @ 0x3b53a230180] Statistics: 40437714 bytes read, 4 seeks
Conversion failed!
I don't think i can test this right now
@mertalev commented on GitHub (Nov 13, 2024):
It seems like this is the relevant line:
Does it fail for all videos, or only certain ones?
@kaaku3 commented on GitHub (Nov 13, 2024):
Thankyou for pointing that out,it seems to be only one file.
I was starting to think something was up with the drivers.
Looks as tho it was uploaded via an immich client on my wife's phone, is it possible it was something up with the upload...
It fell back to software transcode and passed that ok
@mertalev commented on GitHub (Nov 13, 2024):
Thanks for clarifying. I'm assuming the corruption issue is resolved now?
I'm not sure what the issue is for that particular video, but if it worked with software decoding then it's most likely a bug.
@kaaku3 commented on GitHub (Nov 13, 2024):
Yes, I just transcoded that file and it's fixed, thankyou so much.
There is the line still but maybe that's a different issue.
I got a few more errors like the last
I will start again with my system make sure there is nothing up with the GPU drivers.
You wouldn't have any recommendations on a base image for orange pi 5 would you?
@mertalev commented on GitHub (Nov 13, 2024):
ubuntu-rockchip tends to be recommended as the best for hardware acceleration support.
@kaaku3 commented on GitHub (Nov 14, 2024):
Ok, thankyou
@mertalev commented on GitHub (Nov 14, 2024):
You can also try downgrading back to 1.120.1 to see if you still get the same error. That would make it clear whether the issue is due to the different server environment or the FFmpeg change.
@kaaku3 commented on GitHub (Nov 14, 2024):
I just wiped it ;), I'll keep that in mind if it persists
@kaaku3 commented on GitHub (Nov 15, 2024):
Sorry to keeps bothering you here... I think the base system is fine now, but in immich when i run transcoding despite having hardware decoding enable... I don't think it is.
here is the ffmepg output
ffmpeg -n 10 /usr/bin/ffmpeg -i upload/library/admin/2020/2020-10-24/PXL_20201024_021840973.mp4 -y -c:v hevc_rkmpp -c:a aac -movflags faststart -fps_mode passthrough -map 0:1 -map 0:0 -g 256 -tag:v hvc1 -v verbose -vf scale=-2:720 -level 153 -rc_mode CQP -qp_init 28 upload/encoded-video/a32baa7e-7326-459b-a8ab-f08034213bb7/14/de/14de9676-c1c3-4e73-80e8-e3b614773b6d.mp4
edit...
I just noticed this
[Nest] 7 - 11/15/2024, 11:39:53 AM DEBUG [Microservices:MediaService] OpenCL not available for transcoding, so RKMPP acceleration will use CPU decoding
So i think its just me and i need to get opencl working on my system
@mertalev commented on GitHub (Nov 17, 2024):
Yes, the issue is the lack of OpenCL. There's a PR to loosen this restriction so it tries to still use hardware decoding and only do tone-mapping on CPU (if it's an HDR video).
The
Failed to get key input frame from packet meta: -1error you mentioned should be fixed in the next release.@kaaku3 commented on GitHub (Nov 17, 2024):
Thankyou, yeah I was keeping an eye on jellyfin ffmpeg and I hoped that's what that commit meant.
edit...
I don't know how or why, but i after reinstalling everything opencl related, it is working now and hardware decoding is working too.
Thanks for all your help.
@kaaku3 commented on GitHub (Nov 20, 2024):
Hi I just wanted to add that I still have the same
Failed to get key input frame from packet meta: -1 in the latest update.
@mertalev commented on GitHub (Nov 20, 2024):
Unfortunately the fixed version was merged two hours after the release :/
Maybe we can do a patch release.
@kaaku3 commented on GitHub (Nov 20, 2024):
Good to hear the fix is still on the way. Thankyou
@mertalev commented on GitHub (Dec 6, 2024):
Can you confirm if the issue is fully fixed now on 1.122.1?
@kaaku3 commented on GitHub (Dec 7, 2024):
Hi, I'm currently away right now.
I clicked re-transcode all in web interface and kept an eye on it via SSH on my phone. For some reason my system suspended... Maybe I pocket typed something... I'm not sure.
I was able to check that it did about 4 thousand odd transcodes without error before it suspended though, so seems fixed.
Thankyou so much and thankyou for all the hard work.
I'm sorry I can't answer more definitely right now.
@mertalev commented on GitHub (Dec 7, 2024):
Tentatively closing this issue since it sounds like it's fixed
@kaaku3 commented on GitHub (Dec 9, 2024):
I have rechecked my videos and I had absolutely no issues at all, including the line that appears in the video player, that appears fixed too.
Thankyou