title: PowerShell - Changing MP4 Metadata (Right Click Properties)
body: <p>I've been trying to find a way to edit the &quot;Tags&quot; section by swapping it with the &quot;Title&quot; section for MP4.</p>
  <p>The problem is that I can't do this with ExiftTool, MP3Tag, MediaMonkey, and it's a nightmare trying to manually right click and change the Tags for every single file.</p>
  <p><a href="https://i.stack.imgur.com/XS3hX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XS3hX.png" alt="Example Of File Properties" /></a></p>
  <p>The closest I came was an app called MP4 Video &amp; Auto Tag Editor since it lets you edit Microsoft Xtra Atoms, but alas...it doesn't have a way to do this for an entire directory</p>
  <p>I found this PowerShell script, and it shows all the metadata.</p>
  <p>However, I don't know how to exactly edit the &quot;Tags&quot; section to actually customize and trade values. I know ExiftTool could only &quot;read' and not &quot;write&quot; so my biggest fear is that I face the same issue.</p>
  <p>The <strong>SRCDIRECTORY</strong> represents the directory I'm using...</p>
  <pre><code>Function Get-MP3MetaData 
  { 
      [CmdletBinding()] 
      [Alias()] 
      [OutputType([Psobject])] 
      Param 
      ( 
          [String] [Parameter(Mandatory=$true, ValueFromPipeline=$true)] $Directory 
      ) 
   
      Begin 
      { 
          $shell = New-Object -ComObject &quot;Shell.Application&quot; 
      } 
      Process 
      { 
   
          Foreach($Dir in $Directory) 
          { 
              $ObjDir = $shell.NameSpace($Dir) 
              $Files = gci $Dir| ?{$_.Extension -in '.mp3','.mp4'} 
   
              Foreach($File in $Files) 
              { 
                  $ObjFile = $ObjDir.parsename($File.Name) 
                  $MetaData = @{} 
                  $MP3 = ($ObjDir.Items()|?{$_.path -like &quot;*.mp3&quot; -or $_.path -like &quot;*.mp4&quot;}) 
                  $PropertArray = 0,1,2,12,13,14,15,16,17,18,19,20,21,22,27,28,36,220,223 
               
                  Foreach($item in $PropertArray) 
                  {  
                      If($ObjDir.GetDetailsOf($ObjFile, $item)) #To avoid empty values 
                      { 
                          $MetaData[$($ObjDir.GetDetailsOf($MP3,$item))] = $ObjDir.GetDetailsOf($ObjFile, $item) 
                      } 
                    
                  } 
               
                  New-Object psobject -Property $MetaData |select *, @{n=&quot;Directory&quot;;e={$Dir}}, @{n=&quot;Fullname&quot;;e={Join-Path $Dir $File.Name -Resolve}}, @{n=&quot;Extension&quot;;e={$File.Extension}} 
              } 
          } 
      } 
      End 
      { 
      } 
  } 
  
  
  ForEach($item in (&quot;SRCDIRECTORY&quot; |Get-MP3MetaData)){ 
      $itemTitle = $item.Title 
      $itemTags = $item.Tags
  }
  </code></pre>