0

I have too many movies in some hierarchical data structure starting from a directory. I need to remove all their attribute/properties, because some of them have wrong information, and honestly I don't need it.

Typically, the way to do this "manually" (in Windows) is by going to the file's Properties, then Details tab, click on the link at the bottom, then either create a new copy with properties removed, or remove them manually; as shown in the following picture:

enter image description here

I know how to loop over all the files in my movies directory (in both Windows and Linux). So, my question is: Is there a Windows or Linux command prompt/terminal command that will remove these properties, given an mkv/mp4 file?

I expect something like:

mkvtoolnix --remove-all-attributes my-movie.mkv
The Quantum Physicist
  • 770
  • 4
  • 18
  • 36

3 Answers3

0

Did you think of ffmpeg? It is an excellent tool for manupulating video files. Have a look here and see whether it can accomplish what you are looking for.

ffmpeg -i in.mkv -map_metadata -1 -c:v copy -c:a copy out.mkv

This removes metadata and copies both the audio and video streams over to a new file.

Update:

Let's say you have other streams (e.g. subtitles) that you want to preserve, the command becomes (note that this will delete all streams' metadata):

ffmpeg -i in.mkv -map_metadata -1 -c copy -map 0 out.mkv

Let's say you want to suppress only one or more metadata, and not all:

ffmpeg -i in.mkv -metadata title='' -c copy -map 0 out.mkv
simlev
  • 3,912
0

The big thing to bare in mind is that many properties can't be deleted, including things like the title.

Deleting things that can be deleted:

find . -iname \*.mkv -exec mkvpropedit "{}" --tags all: \+

Setting unwanted things that can't be deleted to empty:

find . -iname \*.mkv -exec mkvpropedit "{}" -e info -s title="" \+

You will need to do a few iterations and find out what can and what can't be deleted, and then create a list of things you want empty and tack those on to the 2nd command variant ... I haven't tested what happens when one tries to set a property to empty that currently doesn't exist in the file.

tink
  • 2,059
0
setlocal enabledelayedexpansion
for %%a in ( "*.avi" "*.mkv" "*.mp4" ) do (
(ffmpeg -i "%%a" -map 0 -map_metadata -1 -c copy "1%%%a"))

Here every file .avi .mkv .mp4 within the folder, however:

  • Every file is processed even if it does not contain a title/comment.
  • The original file is left intact with the same name and same metadata.
  • The Output file name begins with a 1, e.g myfile.mp4 will be output as 1myfile.mp4, because it was convient to me -- but, you can remove the 1 appearing in front of the output file name is you prefer that but expect to receive an overwright prompt for each file.

Processing a 1.5gb file takes about 8 seconds on my rig.