Video Transcoding confusion
Heya.. I am trying to figure out "the best" transcoding settings - for me at least.
I thought.. Lets make sure that it is only H264 and AAC that doesn't need to be transcoded, and that all containers needs to be remuxed to MP4. And then of course the transcoding/encoding to the same H264 and AAC - this is at least what I can myself research should be compatible with more or less everything..
However, when I have it like this, some of my videos (already confirmed 15 out of 500) lags really badly.. Like it's only 3-5 FPS - the audio is fine though.
Am I doing something wrong?
If I have the same setup, just with the HEVC video codec also accepted to not be transcoded, everything seems to be fine.. That makes me think the original files are HEVC (H265, right?), but for my understanding that should NOT be able to just fine play on the browser.. So I am really confused. Also a lot more space is used up on the server. Does that make any sense??
Are there any way in Immich to see which type the file currently playing is and such?
I could of course just be fine and say whatever, it works.. But I really want to know why and what is happening haha.
Any helpers? 😄
Version and such attached as image (phone is Immich v1.133.0 on Android 7)



49 Replies
:wave: Hey @Bjørnholt,
Thanks for reaching out to us. Please carefully read this message and follow the recommended actions. This will help us be more effective in our support effort and leave more time for building Immich :immich:.
References
- Container Logs:
docker compose logs
docs
- Container Status: docker ps -a
docs
- Reverse Proxy: https://immich.app/docs/administration/reverse-proxy
- Code Formatting https://support.discord.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline#h_01GY0DAKGXDEHE263BCAYEGFJA
Checklist
I have...
1. :ballot_box_with_check: verified I'm on the latest release(note that mobile app releases may take some time).
2. :blue_square: read applicable release notes.
3. :blue_square: reviewed the FAQs for known issues.
4. :blue_square: reviewed Github for known issues.
5. :blue_square: tried accessing Immich via local ip (without a custom reverse proxy).
6. :blue_square: uploaded the relevant information (see below).
7. :ballot_box_with_check: tried an incognito window, disabled extensions, cleared mobile app cache, logged out and back in, different browsers, etc. as applicable
(an item can be marked as "complete" by reacting with the appropriate number)
Information
In order to be able to effectively help you, we need you to provide clear information to show what the problem is. The exact details needed vary per case, but here is a list of things to consider:
- Your docker-compose.yml and .env files.
- Logs from all the containers and their status (see above).
- All the troubleshooting steps you've tried so far.
- Any recent changes you've made to Immich or your system.
- Details about your system (both software/OS and hardware).
- Details about your storage (filesystems, type of disks, output of commands like fdisk -l
and df -h
).
- The version of the Immich server, mobile app, and other relevant pieces.
- Any other information that you think might be relevant.
Please paste files and logs with proper code formatting, and especially avoid blurry screenshots.
Without the right information we can't work out what the problem is. Help us help you ;)
If this ticket can be closed you can use the /close
command, and re-open it later if needed.HEVC also works in browsers these days
Well, H.265
FireFox added support in a very recent version
Which browser are you using?
Oh didn't know, that's awesome
I am using Brave, so Chromium
But any idea why they would lag so bad with the settings in the screenshot? Or should I just say fuc* it and forget it 😅
https://vdo.ninja/h265 check it out if it works
Do you use HW accel?
Quicksync yes
I'll take a look at it in a couple of hours when I'm home again, thank you!
Might be the hwaccel, but it'll be a deeper dive than just guessing to confirm of course :p
I could try to disable it again and do the transcoding once again - this would be a lot easier without so many videos 🤣
I'll do that and get back to you in some hours - thanks 🎉🎉🎉
YOu can re-transcode a single video @Bjørnholt
On the asset page, just go to the 3 dots menu and select refresh encodes
My god, what a time saver 🤣
Thanks a lot haha - I'll get back in some hours when I'm back home.
I'll try the site you sent and disabling HW - but one can hope that's not the case, since I would imagine not utilizing that would generally slow transcoding down a lot 😅 not sure though tbh.
Yeah slows it down a lot, but only for big ingests
If you just upload day by day it will hardly be noticable 🙂
My guess is the hwa transcoding has an edge case with some videos that causes issues with the frame rate or key frames. Maybe the HEVC encoder doesn’t have that bug
I do recommend using HEVC if you can because it’s a lot more efficient
Oh, and using original resolution can make fairly high bitrate videos even as a transcode, so it’s more likely to cause buffering. It’s fine if you have fast internet but just keep that in mind
Yeah true - that should be totally fine actually 🎉
I see, imma definitely going to try without hwa
So that means I should have H264 and HEVC both checked in the settings right
Luckily 1 gigabit, so that hopefully won't be a problem
If you don’t want originals to get transcoded just because they’re H264, yes
Nice, but also consider mobile internet
FWIW I use HEVC at veryslow preset without hardware acceleration. It’s painfully slow but it gets the best results, both in quality and bitrate
Oh yeah.. That's true 🤯 that could eat data quickly if my wife or myself want to watch videos on the go.. Dang.. But if I choose e.g. 720p, wouldn't it always be low quality I only see my videos in?
Even when home/on wifi?
Yup. You can do 4K with a slow preset + maybe a tad higher crf to get a nice balance
Slower presets generally mean both higher quality and lower bitrate because they work harder to get more effective compression
Maybe that's the way to go, I could try it out. Is it okay I reply to you in a couple of hours when I'm home to confirm the settings? 🙂
Sure!
Hmm, I don't even think I have anything in 4K haha. We only do 1080p or 1440p from our phones 😅 I don't know that much about photo/video technical stuff, but wouldn't keeping it on original instead of 4K be better then?
It never goes above original resolution, it’s more of a cap
e.g. you’re unlikely to have 8K videos, but if you ever do then 4K would downscale where original would not. But they’re more or less the same in most cases since >4K is rare
Setting it to 1440p would also be reasonable to avoid 4K transcodes
Maybe I should just do that then, awesome thank you - wonder if it would make sense to have multiple transcodes? One for mobile and one for big screens 😆 or wifi/data and such.
Because I am a little in the dilemma of which one to choose.. My wife absolutely hates when the quality is less than she wants it to be, but I also would like to be able to watch whatever we want when not on wifi
Oh well, just writing for the sake of writing, and thinking of what could be smart.. 😅
You don't have to use time answering it hehe
Yeah, it’s hard to make a single video that works for every situation. There’s work in progress to add real-time transcoding so the video is in the best resolution, format, etc. for that particular client. This is what Plex, Jellyfin, Emby, etc. do
There are pros and cons to both approaches but I think most people will prefer real-time transcoding once it’s here
fwiw a well-compressed 1440p stream should be fine for both mobile and big screen use, assuming decent mobile speed
The advantage of transcoding in advance is that since there’s no hard time constraint, it’s okay if the transcoding is slower than real-time in order to make the final result better and smaller. If you use good settings then you can make the most of that advantage
Ohh that makes sense - so make a good quality, really compressed transcode to get good quality with small data use.
Well not small... just... smaller 😛
Yeah 😆
So HEVC with veryslow.. What about that CRF value, what do you use there?
I use 28 and the quality is great. I think 29 or even 30 would also be fine if you want to keep the bitrate down
2 pass? 1440p?
2 pass is only particularly good for vp9 or if you set a max bitrate
iirc I have it set to 1440p
bout to toast my setup
24k videos queued
🤣 🤣 🤣
Cool cool 🎉
Looking forward to get home and test it out 😁
Oh and you might want to check cpu utilization. veryslow ironically uses less cpu in my experience, maybe because parallelizing things is worse for quality. I have the concurrency set to 2 I think to keep the cpu busy. This might be a “feature” depending on your server and preferences though
brrrr

(I'm leaving room for other tasks)
oh god this is going to take forever isn't it
24k sounds crazy hahaha - which CPU do you have?
I just have a N355 and no GPU
I see - currently have it to 2 also but that was with quicksync enabled. Curious to see how it does with it disabled
24k videos… it’ll take a few days minimum
yeah but like 20k+ are going to be live photos
btw if you set the log level to debug, it’ll print out progress logs at 10% increments. It’ll only do that for jobs that started after changing the log level though
Can just check the GUI
It's done... 2 videos so far
Bro what hahahaha - is that with the settings mertalev is saying? 🤣
yeah it takes anywhere between 5x to 12x as long as the video is
there was a 4 minute video 🥲
I did say it was painfully slow haha
If it’s too much you can change to slower or slow instead
This might help give an idea https://www.reddit.com/r/ffmpeg/comments/xkv8u3/comment/iqjr2ox/?utm_source=share&utm_medium=mweb3x&utm_name=mweb3xcss&utm_term=1&utm_content=share_button
Reddit
nagareteku's comment on "H.265 – which CRFs yield comparable visu...
Explore this conversation and more from the ffmpeg community
I did also install HEVC codecs for windows finally
now firefox can play them
@mertalev It WAS hwa
Wild stuff - I have learned a lot from you guys in this little chat. Thanks a lot!
These are the new settings I have ended up with from what you guys told me. Looking fine?
I am a bit confused about if I should have the H264 as accepted, or if EVERYTHING should be transcoded to H265? I guess the only thing I would gain in better space if I actually converted it, right? But Immich will keep the original H264 version and then make an extra H265 which then just would make it actually use more space, right?
And then still a biiiit Hmmm about the Preset. 😛


Accepting H.264 is good for storage space and quality (the original is always better than the transcode). Not accepting it is better for bitrate
Okay cool, I think these are the final settings then. I'm gonna try doing all my vidoes now and test a lot of them after. (keeping hwa off)
Honestly, thank you so much
Also you Mraedis 🎉
Hmmm - using 20% CPU and it's going pretty fast (2 concurrent)
Feels like it's no problem at all with these settings
Sweet, glad I could help!
457 videos.. Already done 😅 Honestly went a lot faster without hwa, so that confuses me haha. Added 39GB of storage.
This thread has been closed. To re-open, use the button below.