<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">Patch from https://github.com/sandreas/mp4v2
--- util/mp4tags.cpp
+++ util/mp4tags.cpp
@@ -62,8 +62,27 @@ using namespace mp4v2::util;
 #define OPT_RELEASEDATE  'y'
 #define OPT_ARTISTID     'z'
 #define OPT_COMPOSERID   'Z'
+#define OPT_SORT_NAME    'f'
+#define OPT_SORT_ARTIST   'F'
+#define OPT_SORT_ALBUM_ARTIST   'J'
+#define OPT_SORT_ALBUM   'k'
+#define OPT_SORT_COMPOSER   'K'
+#define OPT_SORT_TV_SHOW   'W'
+#define OPT_PURCHASE_DATE   'U'
+
+#define OPT_STRING  "r:A:a:b:c:C:d:D:e:E:g:G:H:i:I:j:l:L:m:M:n:N:o:O:p:P:B:R:s:S:t:T:U:x:X:w:y:z:Z:f:F:J:k:K:W:"
+
+
+// fFJkKqQuUVWxXYz   (h=help, v=version, r=remove)
+/*
+- MP4TagsSetSortName          ( tags, "my sortName" );  // J
+- MP4TagsSetSortArtist        ( tags, "my sortArtist" ); // f
+- MP4TagsSetSortAlbumArtist   ( tags, "my sortAlbumArtist" ); // F
+- MP4TagsSetSortAlbum         ( tags, "my sortAlbum" ); u
+- MP4TagsSetSortComposer      ( tags, "my sortComposer" ); r
+- MP4TagsSetSortTVShow        ( tags, "my sortTVShow" ); W
+*/
 
-#define OPT_STRING  "r:A:a:b:c:C:d:D:e:E:g:G:H:i:I:j:l:L:m:M:n:N:o:O:p:P:B:R:s:S:t:T:x:X:w:y:z:Z:"
 
 #define ELEMENT_OF(x,i) x[int(i)]
 
@@ -110,6 +129,13 @@ static const char* const help_text =
     "  -y, -year        NUM  Set the release date\n"
     "  -z, -artistid    NUM  Set the artist ID\n"
     "  -Z, -composerid  NUM  Set the composer ID\n"
+    "  -f, -sortname    STR  Set the sort name\n"
+    "  -F, -sortartist  STR  Set the sort artist\n"
+    "  -k, -sortalbum   STR  Set the sort album\n"
+    "  -W, -sorttvshow  STR  Set the sort tv show\n"
+    "  -J, -sortalbumartist STR  Set the sort album artist\n"
+    "  -K, -sortcomposer    STR  Set the sort composer\n"
+    "  -U, -purchasedate    STR  Set the purchase date\n"
     "  -r, -remove      STR  Remove tags by code (e.g. \"-r cs\"\n"
     "                        removes the comment and song tags)";
 
@@ -155,8 +181,15 @@ extern "C" int
         { "composerid",  prog::Option::REQUIRED_ARG, 0, OPT_COMPOSERID   },
         { "remove",      prog::Option::REQUIRED_ARG, 0, OPT_REMOVE       },
         { "albumartist", prog::Option::REQUIRED_ARG, 0, OPT_ALBUM_ARTIST },
-        { "category",    prog::Option::REQUIRED_ARG, 0, OPT_CATEGORY },
-        { "rating",      prog::Option::REQUIRED_ARG, 0, OPT_RATING },
+        { "category",    prog::Option::REQUIRED_ARG, 0, OPT_CATEGORY     },
+        { "rating",      prog::Option::REQUIRED_ARG, 0, OPT_RATING       },
+        { "sortname",    prog::Option::REQUIRED_ARG, 0, OPT_SORT_NAME    },
+        { "sortartist",  prog::Option::REQUIRED_ARG, 0, OPT_SORT_ARTIST  },
+        { "sortalbum",   prog::Option::REQUIRED_ARG, 0, OPT_SORT_ALBUM   },
+        { "sorttvshow",  prog::Option::REQUIRED_ARG, 0, OPT_SORT_TV_SHOW },
+        { "sortalbumartist",   prog::Option::REQUIRED_ARG, 0, OPT_SORT_ALBUM_ARTIST },
+        { "sortcomposer",      prog::Option::REQUIRED_ARG, 0, OPT_SORT_COMPOSER     },
+        { "purchasedate",      prog::Option::REQUIRED_ARG, 0, OPT_PURCHASE_DATE },
         { NULL, prog::Option::NO_ARG, 0, 0 }
     };
 
@@ -381,6 +414,27 @@ extern "C" int
                     case OPT_RATING:
                         MP4TagsSetContentRating(mdata, NULL);
                         break;
+                    case OPT_SORT_NAME:
+                        MP4TagsSetSortName( mdata, NULL );
+                        break;
+                    case OPT_SORT_ARTIST:
+                        MP4TagsSetSortArtist( mdata, NULL );
+                        break;
+                    case OPT_SORT_ALBUM_ARTIST:
+                        MP4TagsSetSortAlbumArtist( mdata, NULL );
+                        break;
+                    case OPT_SORT_ALBUM:
+                        MP4TagsSetSortAlbum( mdata, NULL );
+                        break;
+                    case OPT_SORT_COMPOSER:
+                        MP4TagsSetSortComposer( mdata, NULL );
+                        break;
+                    case OPT_SORT_TV_SHOW:
+                        MP4TagsSetSortTVShow( mdata, NULL );
+                        break;
+                    case OPT_PURCHASE_DATE:
+                        MP4TagsSetPurchaseDate( mdata, NULL );
+                        break;
                 }
             }
         }
@@ -588,6 +642,28 @@ extern "C" int
                         MP4TagsSetContentRating(mdata, &amp;rating);
                         break;
                     }
+
+                    case OPT_SORT_NAME:
+                        MP4TagsSetSortName( mdata, tags[i] );
+                        break;
+                    case OPT_SORT_ARTIST:
+                        MP4TagsSetSortArtist( mdata, tags[i] );
+                        break;
+                    case OPT_SORT_ALBUM_ARTIST:
+                        MP4TagsSetSortAlbumArtist( mdata, tags[i] );
+                        break;
+                    case OPT_SORT_ALBUM:
+                        MP4TagsSetSortAlbum( mdata, tags[i] );
+                        break;
+                    case OPT_SORT_COMPOSER:
+                        MP4TagsSetSortComposer( mdata, tags[i] );
+                        break;
+                    case OPT_SORT_TV_SHOW:
+                        MP4TagsSetSortTVShow( mdata, tags[i] );
+                        break;
+                    case OPT_PURCHASE_DATE:
+                        MP4TagsSetPurchaseDate( mdata, tags[i] );
+                        break;
                 }
             }
         }

</pre></body></html>