Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. Hi. The standard device limit is 30. Are you having a problem?
  3. josenightbreed

    Themes and Trailers python script

    I want to share a script I made in python that creates theme videos and trailers from the existing movie library completely offline. Requirements ======================== ## Requirements ### Linux Install FFmpeg: ```bash sudo pacman -S ffmpeg '`` or use your distribution's package manager. ### Python Python 3.8+ recommended. Verify: ```bash python3 --version ``` ### Dependencies No external Python packages are required. The script only uses Python standard library modules and FFmpeg/FFprobe. ## Script was tested on 1,899 movies including: MP4 MKV HEVC/H.265 H.264 Multi-audio releases Anime releases with PGS subtitles NTFS media drives mounted under Linux in a intel n150 mini pc running linux mint. I use filebot for renaming and posters and stuff as it works great on movies, series and animes. The pc i run the script in is a AMD Ryzen™ 9 6900HX with Radeon™ Graphics × 16 Minis Forums mini pc and emby is running in a intel n150 mini pc running linux mint, drives i use for media on that server are all external usb formatted in ntfs and i mount all the media drives from the emby server via CIFS on my pc where i run the script in. As you can see i battle tested this lol I've only used it for movies, i have not tried it in series fearing that it will mess the library up. the output of the script is: Movies/ └── Ad Astra (2019) ├── Ad Astra (2019).mkv ├── Ad Astra (2019)-trailer.mp4 └── backdrops ├── theme.mp4 └── .processed I do the folder structure and renaming with filebot and the script generates the ├── Ad Astra (2019)-trailer.mp4 └── backdrops ├── theme.mp4 └── .processed The .processed file is to prevent duplication, and it tells the script to skip the movies already done. You can run it as many times as need it (I ran it multiple times after adding new additions to my library) It ran on 1880+ movies ≈10.5 hours runtime, and it did every single one them. If run locally on the server it should be faster. This is the script, I named mine backdrops.py, but you can name it what ever it makes sense to you: ********************************************************************************************************* #!/usr/bin/env python3 """ Emby Theme + Trailer Generator Creates: backdrops/theme.mp4 Movie Name-trailer.mp4 for every movie folder in a library. Features: - Multi-process - Resume support - MP4 / MKV support - Emby-compatible trailer naming - Offline operation - Handles anime and multi-audio releases Author: Jose Cortes License: MIT """ import os import subprocess from concurrent.futures import ProcessPoolExecutor # ===================================================== # CONFIG # ===================================================== VERSION = "1.0" MOVIE_ROOTS = [ "/mnt/media/NucBoxG9/disk1/Movies", "/mnt/media/NucBoxG9/disk2/Movies", ] WORKERS = 1 THEME_LENGTH = 12 TRAILER_CLIP_LENGTH = 15 TRAILER_POSITIONS = [ 0.10, 0.18, 0.26, 0.34, 0.42, 0.50, 0.58, 0.66, 0.74, ] # ===================================================== # UTILITIES # ===================================================== def get_duration(movie_path): output = subprocess.check_output([ "ffprobe", "-v", "error", "-show_entries", "format=duration", "-of", "default=noprint_wrappers=1:nokey=1", movie_path ]) return float(output.decode().strip()) # ===================================================== # THEME VIDEO # ===================================================== def create_theme(movie_path, output_path, duration): start = int(duration * 0.30) cmd = [ "ffmpeg", "-y", "-ss", str(start), "-i", movie_path, "-map", "0:v:0", "-map", "0:a:0?", "-t", str(THEME_LENGTH), "-c:v", "libx264", "-preset", "veryfast", "-crf", "23", "-c:a", "aac", "-ac", "2", output_path ] subprocess.run( cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True ) # ===================================================== # TRAILER GENERATION # ===================================================== def create_trailer(movie_path, trailer_path, duration): temp_files = [] for idx, pct in enumerate(TRAILER_POSITIONS): start = int(duration * pct) temp_clip = f"/tmp/trailer_clip_{os.getpid()}_{idx}.mp4" cmd = [ "ffmpeg", "-y", "-ss", str(start), "-i", movie_path, "-map", "0:v:0", "-map", "0:a:0?", "-t", str(TRAILER_CLIP_LENGTH), "-c:v", "libx264", "-preset", "veryfast", "-crf", "23", "-c:a", "aac", "-ac", "2", temp_clip ] subprocess.run( cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True ) temp_files.append(temp_clip) concat_file = f"/tmp/trailer_concat_{os.getpid()}.txt" with open(concat_file, "w") as f: for clip in temp_files: f.write(f"file '{clip}'\n") cmd = [ "ffmpeg", "-y", "-f", "concat", "-safe", "0", "-i", concat_file, "-c", "copy", trailer_path ] subprocess.run( cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True ) for clip in temp_files: try: os.remove(clip) except: pass try: os.remove(concat_file) except: pass # ===================================================== # FIND MOVIES # ===================================================== def find_movies(): movies = [] for root in MOVIE_ROOTS: if not os.path.exists(root): continue for folder in os.listdir(root): full = os.path.join(root, folder) if not os.path.isdir(full): continue candidates = [] for f in os.listdir(full): if f.lower().endswith(( ".mkv", ".mp4", ".avi", ".mov", ".m4v", ".webm" )): path = os.path.join(full, f) try: candidates.append( (os.path.getsize(path), path) ) except: pass if candidates: movies.append( (full, max(candidates)[1]) ) return movies # ===================================================== # PROCESS MOVIE # ===================================================== def process_movie(task): folder, movie_path = task backdrop_dir = os.path.join(folder, "backdrops") os.makedirs(backdrop_dir, exist_ok=True) processed_marker = os.path.join( backdrop_dir, ".processed" ) if os.path.exists(processed_marker): return movie_name = os.path.splitext( os.path.basename(movie_path) )[0] trailer_path = os.path.join( folder, f"{movie_name}-trailer.mp4" ) theme_path = os.path.join( backdrop_dir, "theme.mp4" ) try: print(f" Processing: {movie_name}") duration = get_duration(movie_path) create_theme( movie_path, theme_path, duration ) create_trailer( movie_path, trailer_path, duration ) if ( os.path.exists(theme_path) and os.path.exists(trailer_path) ): open(processed_marker, "w").close() print(f" Done: {movie_name}") else: print(f" Missing output: {movie_name}") except Exception as e: print( f" Failed: {movie_name} -> {e}" ) # ===================================================== # MAIN # ===================================================== if __name__ == "__main__": movies = find_movies() # TEST MODE # movies = movies[:20] print(f"\n Found {len(movies)} movies\n") with ProcessPoolExecutor( max_workers=WORKERS ) as executor: executor.map( process_movie, movies ) print("\n Library processing complete.\n") ************************************************************************************************************************ Change: MOVIE_ROOTS = [ "/mnt/media/NucBoxG9/disk1/Movies", "/mnt/media/NucBoxG9/disk2/Movies", ] To wherever you're disks are mounted. I would only modify: WORKERS = 1 to a higher value only if your pc can handle it. THEME_LENGTH = 12 TRAILER_CLIP_LENGTH = 15 Yields good file size results as is making the theme.mp4 around 12 secs and the *-trailer.mp4 around 2:15 minutes. They turned out to be pretty decent might I add specially compared to YouTube downloaded trailers that have branding and crappy resolution most of the time. I really hope it's useful for many of you, and please modify it as you see fit and share the results and mods so we can all benefit. I almost forgot, I'm not a programmer, I'm a retired pc tech and programming languages have always been my bane. This is the result of throwing ideas into ChatGPT and testing and troubleshooting the results. I finally found a way to use AI for something other than making cute cat girls. backdrops.py
  4. AlmostTonyStark

    Playback pauses

    Yes.
  5. AlmostTonyStark

    Cloudflare + nginx + Emby (Windows)

    How can we use CloudFlare http header authentication using an iOS app that connects to Emby? The native Emby iOS app doesn’t support this.
  6. yocker

    Plugin: WatchingEye - Manage viewers

    Must admit i have purposely ignored doing anything to this plugin because i regret ever coming up with the idea for it. Almost every time i see it mentioned it's by people using it for their streaming shares (pirate Netflix servers) where they now (thanks to this plugin) now sell watching hours. I will look into this problem and after that i will delete everything to do with the plugin and hope the developers make something better and less beneficial for the pirates. This is nobody's fault other than those people using it for piracy!! Sorry you got to be the target of the rant, just had to get it off my chest.
  7. vincen

    Problème chromecast/App

    Salut, Tu as bien utilisé le bouton de Cast dans l'app Emby elle même ? pas celui d'Android ? Ton téléphone est connecté via l'url directe ? pas par emby connect ? Ton chromecast est sur le même réseau que ton téléphone et ton serveur emby bien sûr ?
  8. NoMax

    Problème chromecast/App

    Bonjour, j'ai Emby Server en local et je me suis link a emby connect. Mon serveur marche en localhost et en http://10.23.214.246:8096 Sur mon téléphone l'application reconnait mon serveur, donc j'essaye de cast depuis mon téléphone vers le chromecast et j'ai un "Ready to cast" avec un rond qui tourne indéfiniment lorsque je veux balancer une vidéo. J'ai installé Emby Android TV sur mon chromecast mais il ne trouve pas mon serveur en local host
  9. Well that took me a hot minute to find, but that helped nudge me in the right direction. I had changed these some time back as part of my troubleshooting with no effect. Those are currently set to 5 / 99 / 30
  10. HouseOfCards

    Genre Images

    Sorry, buddy. That doesn't work. Like the user above, I tried all that. Once they are gone, they never come back. Scan media and refresh metadata have no effect.
  11. MaciekZd

    emby autoupdate on qnap

    Hi everyone, Since Emby doesn't update automatically on QNAP and I like to keep everything up to date, I used some of my free time and spare tokens today to build a little app. It simplifies the update process or can even take it over completely (I know, I know – it's risky, reckless, etc., but that's what backups are for, right? :)). If anyone has similar needs, the project is hosted here It's definitely not a masterclass in coding, but it gets the job done Unfortunately, it requires Qbase24 and is only for x86_64 (compiled and tested on hs-453dx), but maybe someone will find it useful! Feel free to test it, use it, or dump it.
  12. Neminem

    Plugin: WatchingEye - Manage viewers

    @johyphenelfirst post has the github link
  13. Today
  14. @pünktchenAs you ask me embyserver.txt
  15. Did you alter this section of you TV Show library.
  16. Howdy all. I've been trying out Emby on and off for a couple years, and this is one problem that persists and has kept me from switching from Plex. For any given TV episode, the moment I start playback, it gets flagged as watched. So if I exit out partway through and return later, the subsequent episode is what's presented to me as next to watch. I've dug around on the forums and have seen references to a setting to set a "resume duration", but I cannot locate it anywhere. Any advice? I'm up-to-date with Emby Server, 4.9.5.0 on macOS 15.7.7 (Intel).
  17. dprovencher

    Welcome/help/howto landing page (on another port)

    Nice thanks, could be a workaround for now!
  18. warrencalvert

    NVidia Shield playback spinning/fails to start

    Hi Luke Have you had a chance to look at this yet? Thanks, Warren.
  19. PuffyToesToo

    Welcome/help/howto landing page (on another port)

    Using text, arrows and circling things helps them a lot.
  20. PuffyToesToo

    Welcome/help/howto landing page (on another port)

    I used screenshots from a computer. I used Photos of the TV Screen, as well as videos. I also used editing software to add text or create text only instructions for them to accompany the image. Then I simply added them to a 'Mixed Content' library type. Each image/video was given a filename that tells my parents what it is. For example: 'How To Favourite Something", or "How to Add To Playlist". If it requires more than one step, I simply named it with 'Step 1', Step 2', etc. Hope that helps.
  21. johyphenel

    Plugin: WatchingEye - Manage viewers

    Timeout still doesn't block watching on Emby web - 1.6.4.0 Is the code on github anywhere, happy to take a look to help track this down.
  22. I too would really like to be able to disable the "On Now" section from the home screen. It seems like if I disable Live TV all the links to it go away (not sure why it's not on the sidebar as well under "my media" but it's not). We really do very little Live TV anymore, but need to be able to manage a couple of recordings. I hate having the home screen cluttered with random junk programs I don't watch. I love that Emby lets me have so much more control over the appearance of things than Plex did. This seems like a gap worth closing :)
  23. hatharry

    Alexa Playback [Logging] Advice/Support

    Alexa logs show "error": { "message": "Device playback error", "type": "MEDIA_ERROR_INVALID_REQUEST" }, You should see something like this in the log Info UniversalAudioService-0HNM0PCRJ4DBQ:00000001: http/1.1 Response 200 to host1. Time: 3967ms. GET http://emby_remote_ip/emby/Audio/814045/universal?api_key=x_secret6_x&DeviceId=1640bc1d001abd85c16096b01783036e&StartTimeTicks=0&MaxStreamingBitrate=384000&Container=mp3|mp3,m4a|aac,mp4|aac&TranscodingContainer=aac&TranscodingProtocol=http&AudioCodec=aac&MaxAudioSampleRate=48000&MaxAudioBitDepth=16. Headers: Content-Type=audio/mp4 Your ddns might not be supported. Does the same happen when using your phone?
  24. Legend1981

    Premiere device limit exceeded.

    I have license life time and dont acess 50 Devices Monthly minimum?
  25. iflo

    Genre Images

    I have the same issue - where all my genre images (in music) disappeared and I'm struggling to get them back. I've tried a refresh metadata and a scan library files but they're not re-appearing. It used to do a tiled 2x2 image of albums in each genre.
  26. vincen

    No genre for movies in foreign languages :(

    Why not do it based on IANA list of non routable IPs ? If the IP is not in the non routable IP ranges, you anonymize it no ? non routable IPs have no problem of privacy as you can't track them at anything
  27. Napsterbater

    Search Very Slow (3 minute response)

    It would be one thing if the search results were just slow and that was it. The fact that for us that are affected it completely locks up a server for up to multiple minutes, which is just ridiculous. For those affected too, we cannot disable search. Otherwise that would be a simple workaround, instead if any of my users forget and click on search, they break the server for a couple of minutes for everybody.
  1. Load more activity
×
×
  • Create New...