• AnyStream is having some DRM issues currently, Netflix is not available in HD for the time being.
    Situations like this will always happen with AnyStream: streaming providers are continuously improving their countermeasures while we try to catch up, it's an ongoing cat-and-mouse game. Please be patient and don't flood our support or forum with requests, we are working on it 24/7 to get it resolved. Thank you.

Export MP4 Metadata to CSV or Excel

zero269

Well-Known Member
Thread Starter
Joined
Feb 2, 2007
Messages
514
Likes
285
Hello,

I've seen a lot of people talk about using utilities like ffmpeg and MediaInfo to work with video files and now I find myself in need of extracting some metadata from the File Properties to work with in Excel.

I've scoured the Internet looking for a way using the Windows Command Prompt and PowerShell, but they both come up dead.

For those of you who are well versed in using ffmpeg or MediaInfo... is it possible to export both the Filename and the Title (Properties) from the video file and then export those two pieces of information into an Excel (.xlsx) or CSV (.csv) file?

I would like to run the script/command line against a folder containing many MP4 files.

Title
upload_2022-8-29_20-0-48.png

Filename:
upload_2022-8-29_20-1-30.png

Desired output:

CSV file (Left), Excel file (Right)
upload_2022-8-29_20-5-27.png

Any help would be greatly appreciated. Thanks.
 
This is pretty trivial with the right tools like grep and sed (which come with msys, et. al.).

using FOR to iterate over the files (*.mp4), will give you the file name in the loop variable [e.g., FOR %%i in (*.mp4)]

then there are many tools that will dump the properties of the files. For example, using ffprobe (with comes with ffmpeg):

ffprobe -show_entries "stream_tags : format_tags" file.mp4

will do it. Using grep will just get the title property:

ffprobe -show_entries "stream_tags : format_tags" file.mp4 2>&1 | grep "^ *title"

this give an output like " title : Cosmos: Possible Worlds (S1E1): Ladder to the Stars"

using sed on that will get just the actual title:

ffprobe -show_entries "stream_tags : format_tags" file.mp4 2>&1 | grep "^ *title" | sed "s/^ *title *: *\(.*\)/\1/"

Cosmos: Possible Worlds (S1E1): Ladder to the Stars

echo the two piece to a file and you're done.

so, something like:

Code:
echo Filename,Title > file.csv

for %%i in ("*.mp4") do (

     ffprobe -show_entries "stream_tags : format_tags" file.mp4 2>&1 | grep "^ *title" | sed "s/^ *title *: *\(.*\)/%i,\1/" >> file.csv

)



Something along those lines...

FOR can also parse the output of a command, but I'm not as well versed in that.
 
Last edited:
You could use EMDB for this. Just go download EMDB (it's free) let it pull your media and then run an export.
 
You could use EMDB for this. Just go download EMDB (it's free) let it pull your media and then run an export.

That looks cool. I've been using an Excel spreadsheet to track my collection (it automatically changes displayed artwork when you change lines).

How good is EMDB when scanning folders? I gotta lot of stuff! :ROFLMAO:
 
That looks cool. I've been using an Excel spreadsheet to track my collection (it automatically changes displayed artwork when you change lines).

How good is EMDB when scanning folders? I gotta lot of stuff! :ROFLMAO:

I use it for my entire collection. I actually use it with things broken down into folders. So to answer your question it does great.

The custom fields are especially handy. Whenever I find a title I think I want I check my EMDB first to see if I have it and if I do I have at my fingertips what the source was, what the mediainfo on it is, where it came from etc.
 
Could be done with powershell in a one-liner if you are willing to install a PS-Module PSSharedGoods ... available at GitHub

The following must be done only once.
Open Powershell in Administrator Mode
Code:
Import-Module PSSharedGoods
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
That second command might lower your system security.

Close powershell and open it normally again
You might want to check, what values you can export ...
Code:
Get-FileMetaData "<PathAndFilename>"

And if you know what you want to export
Code:
Get-ChildItem "<PathToVideoFolder>" -Recurse | Get-FileMetaData | select <CommaSeparatedPropertiesToExport> | Export-Csv -Path <ExportPathAndFile>
Be aware the properties names depend on OS language (I guess)
So in my example on a German Windows it would look like this
Code:
Get-ChildItem "U:\Temp\" -Recurse | Get-FileMetaData | select Name,Titel | Export-Csv -Path C:\Temp\export.csv

I noticed it could take a long time on several files, probably due to much metadata
 
For example, using ffprobe (with comes with ffmpeg):
Hi DrXenos,
Thanks for this information. I've never used ffmpeg before, so I downloaded it and tried your examples. The first produced the information you said it would. I could see the filename and Title listed in that myriad of information. However, when I tried the 2nd and 3rd examples, they errored out saying that grep was not recognizable.

I tried your code and used full paths for ffprobe.exe, my movie.mp4 and the output file to see if I could get it to read at least one of the four files I was using for my testing. Unfortunately, it didn't output any information other than the headers... which was created using the first line of code.
 
You could use EMDB for this. Just go download EMDB (it's free) let it pull your media and then run an export.
Hi DQ,

Thanks for the recommendation. I tried out the EMDB program in a VM to see how this works. I was able to import my 4 movie test files, but the Export options were not customizable, and it didn't export the filename or the actual value in the files Title properties. It does output the name of movie though.

upload_2022-8-30_13-28-44.jpeg

Two of my test mp4 files are named incorrectly, so I should see the filename is different than the Title properties of the file.
Thank you for your efforts.
 
Hi DrXenos,
Thanks for this information. I've never used ffmpeg before, so I downloaded it and tried your examples. The first produced the information you said it would. I could see the filename and Title listed in that myriad of information. However, when I tried the 2nd and 3rd examples, they errored out saying that grep was not recognizable.

I tried your code and used full paths for ffprobe.exe, my movie.mp4 and the output file to see if I could get it to read at least one of the four files I was using for my testing. Unfortunately, it didn't output any information other than the headers... which was created using the first line of code.

Right, I said grep and sed aren't part of Windows by default. You have to get them, like from msys, cygwin, MinGW, GnuWin32, etc (i.e., a set of GNU POSIX tools build for windows).
 
Could be done with powershell
Hi cartman,

PowerShell is definitely my preferred method. I looked into that module and was able to run it against my test files and get the results I was looking for.
Unfortunately, this module is a bit unstable, and runs very slow.

When running it against my 4 local mp4 files, it averages 3.75 seconds per file.
Running it against the network is currently averaging around 14.57 seconds per file.

Running the numbers based on that average, it's going to take about 25 hours to complete; 6,262 files.
This is fine considering I need to only so this once to correct some mistakes I made the other day when batch renaming files. Some got renamed incorrectly, and I need this comparison to check for matches and mismatches using Excel once I get my full list.

Thanks a lot for you help with this. Doing this manually in File Explorer is just too damn time consuming and would likely take weeks to verify all of the files. I suspect I only have about 1% mismatches... I hope. (y)

upload_2022-8-30_13-41-19.png
 
Right, I said grep and sed aren't part of Windows by default.
It appears I overlooked that part. I thought it was part of the ffprobe utility that came with the ffmpeg download. I'll have to look into msys and run a test in a VM.
Thanks again... (y)
 
Actually you could use Powershell to rename the files like the title, if that's what you're after ;)
 
Actually you could use Powershell to rename the files like the title, if that's what you're after ;)
That was my goal, but unfortunately lining up the Title from the misnamed file with the correct filename for 6k+ files was much more challenging than I anticipated. I thought I could use the compare functionality in Excel to help identify them faster... that proved to be much more difficult.

I settled on restoring my Snapshot... much faster. However, without that snapshot feature on my NAS, I would have been in a world of hurt getting them all renamed properly.
 
Did you by chance come across the tool Metadata++ (I like the title, because I'm a huge fan of Notepad++ :D)
It might not be able to resolve your issue, but could give a quick overview on all metadata
 
Back
Top