Versions are sorted in reverse alphabetical order when filename includes resolution #6258

Closed
opened 2025-12-22 03:56:13 +01:00 by backuprepo · 3 comments
Owner

Originally created by @theguymadmax on GitHub (Sep 9, 2024).

When multiple files share the same resolution in their filenames, they are sorted in reverse alphabetical order.
54f663b0f3/Emby.Naming/Video/VideoListResolver.cs (L144)
Screenshot from 2024-09-09 10-50-18



Since the resolutions are sorted based on the MediaInfo, it should be sufficient to change OrderByDescending to just OrderBy .

videos.InsertRange(0, group.OrderBy(x => x.Files[0].FileNameWithoutExtension.ToString(), new AlphanumericComparator())); 

Making this change resolves the issue, and resolutions are sorted alphabetical, with higher resolutions listed first, regardless of whether the resolution is included in the filename.

Screenshot from 2024-09-09 10-46-21

Server: 10.9.11

Originally created by @theguymadmax on GitHub (Sep 9, 2024). When multiple files share the same resolution in their filenames, they are sorted in reverse alphabetical order. https://github.com/jellyfin/jellyfin/blob/54f663b0f3c4a9cc5a4f44d1afcb6e1de03c0503/Emby.Naming/Video/VideoListResolver.cs#L144 ![Screenshot from 2024-09-09 10-50-18](https://github.com/user-attachments/assets/a81fb785-3521-4b8d-8964-41e516c22220) <br><br> Since the resolutions are sorted based on the MediaInfo, it should be sufficient to change `OrderByDescending` to just `OrderBy` . ```c# videos.InsertRange(0, group.OrderBy(x => x.Files[0].FileNameWithoutExtension.ToString(), new AlphanumericComparator())); ``` <br> Making this change resolves the issue, and resolutions are sorted alphabetical, with higher resolutions listed first, regardless of whether the resolution is included in the filename. ![Screenshot from 2024-09-09 10-46-21](https://github.com/user-attachments/assets/db23c97a-0895-404c-b172-07a0d475341f) Server: 10.9.11
backuprepo 2025-12-22 03:56:13 +01:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@felix920506 commented on GitHub (Sep 9, 2024):

Please provide the media info of all 3 files

@felix920506 commented on GitHub (Sep 9, 2024): Please provide the media info of all 3 files
Author
Owner

@theguymadmax commented on GitHub (Sep 9, 2024):

Those were all the same file, just renamed. I'll also upload with different resolutions in a bit.

General
Unique ID                                : 34727860135091814094139690058492232674 (0x1A2057B2EBC11E00F924498B258D43E2)
Complete name                            : /media/max/testmedia/Multiple Versions/Big Buck Bunny (2008)/Big Buck Bunny (2008) - 2160p Director's cut.mkv
Format                                   : Matroska
Format version                           : Version 4
File size                                : 604 MiB
Duration                                 : 10 min 34 s
Overall bit rate                         : 7 980 kb/s
Frame rate                               : 30.000 FPS
Movie name                               : Big Buck Bunny, Sunflower version
Encoded date                             : 2024-06-23 14:51:05 UTC
Writing application                      : mkvmerge v85.0 ('Shame For You') 64-bit
Writing library                          : libebml v1.4.5 + libmatroska v1.7.1
Comment                                  : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L5.1
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 10 min 34 s
Bit rate                                 : 7 500 kb/s
Width                                    : 3 840 pixels
Height                                   : 2 160 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 30.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.030
Stream size                              : 567 MiB (94%)
Writing library                          : x264 core 120
@theguymadmax commented on GitHub (Sep 9, 2024): Those were all the same file, just renamed. I'll also upload with different resolutions in a bit. ``` General Unique ID : 34727860135091814094139690058492232674 (0x1A2057B2EBC11E00F924498B258D43E2) Complete name : /media/max/testmedia/Multiple Versions/Big Buck Bunny (2008)/Big Buck Bunny (2008) - 2160p Director's cut.mkv Format : Matroska Format version : Version 4 File size : 604 MiB Duration : 10 min 34 s Overall bit rate : 7 980 kb/s Frame rate : 30.000 FPS Movie name : Big Buck Bunny, Sunflower version Encoded date : 2024-06-23 14:51:05 UTC Writing application : mkvmerge v85.0 ('Shame For You') 64-bit Writing library : libebml v1.4.5 + libmatroska v1.7.1 Comment : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L5.1 Format settings : CABAC / 4 Ref Frames Format settings, CABAC : Yes Format settings, Reference frames : 4 frames Codec ID : V_MPEG4/ISO/AVC Duration : 10 min 34 s Bit rate : 7 500 kb/s Width : 3 840 pixels Height : 2 160 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 30.000 FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.030 Stream size : 567 MiB (94%) Writing library : x264 core 120 ```
Author
Owner

@theguymadmax commented on GitHub (Sep 9, 2024):

Example with different resolution, current behavior:
Screenshot from 2024-09-09 14-58-44



With proposed changed in code:
Screenshot from 2024-09-09 14-58-39


Only two files tested here one 2160p media info above and 1080p info below. All versions are just copies.

General
Complete name                            : /media/max/testmedia/Multiple Versions/Big Buck Bunny (2008)/Big Buck Bunny (2008) - Alpha teneightyp.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/avc1)
File size                                : 263 MiB
Duration                                 : 10 min 34 s
Overall bit rate                         : 3 481 kb/s
Frame rate                               : 30.000 FPS
Movie name                               : Big Buck Bunny, Sunflower version
Performer                                : Blender Foundation 2008, Janus Bager Kristensen 2013
Composer                                 : Sacha Goedegebure
Genre                                    : Animation
Encoded date                             : 2013-12-16 17:44:39 UTC
Tagged date                              : 2013-12-16 17:44:39 UTC
Comment                                  : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
com                                      : Jan Morgenstern

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.1
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 10 min 34 s
Bit rate                                 : 3 000 kb/s
Maximum bit rate                         : 16.7 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 30.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.048
Stream size                              : 227 MiB (86%)
Writing library                          : x264 core 115
@theguymadmax commented on GitHub (Sep 9, 2024): Example with different resolution, current behavior: ![Screenshot from 2024-09-09 14-58-44](https://github.com/user-attachments/assets/5e48ddc0-7e80-4028-8c6e-681798ab531d) <br><br> With proposed changed in code: ![Screenshot from 2024-09-09 14-58-39](https://github.com/user-attachments/assets/105a85d7-c34e-4f82-b0c6-92847ff75404) <br> Only two files tested here one 2160p media info above and 1080p info below. All versions are just copies. ``` General Complete name : /media/max/testmedia/Multiple Versions/Big Buck Bunny (2008)/Big Buck Bunny (2008) - Alpha teneightyp.mp4 Format : MPEG-4 Format profile : Base Media Codec ID : isom (isom/avc1) File size : 263 MiB Duration : 10 min 34 s Overall bit rate : 3 481 kb/s Frame rate : 30.000 FPS Movie name : Big Buck Bunny, Sunflower version Performer : Blender Foundation 2008, Janus Bager Kristensen 2013 Composer : Sacha Goedegebure Genre : Animation Encoded date : 2013-12-16 17:44:39 UTC Tagged date : 2013-12-16 17:44:39 UTC Comment : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net com : Jan Morgenstern Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4.1 Format settings : CABAC / 4 Ref Frames Format settings, CABAC : Yes Format settings, Reference frames : 4 frames Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 10 min 34 s Bit rate : 3 000 kb/s Maximum bit rate : 16.7 Mb/s Width : 1 920 pixels Height : 1 080 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 30.000 FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.048 Stream size : 227 MiB (86%) Writing library : x264 core 115 ```
Sign in to join this conversation.
No milestone
No project
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/jellyfin#6258
No description provided.