Over the past year I haven't found a solution...but got close today. I have roughly 3,000 episodes in 180 separate TV show folders. Each TV show folder has "Season" subfolders that contain the MKV's. I would like to delete all the jpg attachments embedded in these MKV's which are posters and banners.
I ran into 2 issues:
1) The tool JMkvPropedit seems to work, the below attachments are gone from view after batch processing, but the MKV file size doesn't change. Is this tool just disabling them from view? The tool doesn't seem rewrite over the file to save a new smaller one.
2) The JMkvPropedit tool requires you select each MKV file manually to add it to their app. It doesn't allow you to select an entire folder of MKV's. This is very labor intensive. Their recent release 22.214.171.124 stated "Now it's also possible to add folders to the file list" but I can figure out how of if this works.
+ Reply to Thread
Results 1 to 19 of 19
Since it's just a front end for MKVPropEdit, then when you remove an attachment all that happens is that the attachment is overwritten with a void element of the same size. To make things worse, unless there's already tags before the attachment and since MKVPropEdit doesn't leave a pointer to this void element, if you add another attachment later the program will simply extend the file size and add the new attachment in the new space, meaning if you continually delete and add attachments using MKVPropEdit the file will continue to grow in size indefinitely. I mentioned it to Mosu at one point, assuming he didn't miss the reference amidst the rest of the email and assuming it's even possible to fix he may have corrected that problem, I haven't checked.
I think you need to drag and drop the folder onto the window.
Never used Hybrid for that, but what should work is:
- Start Hybrid
- Enable "Config->Path->Adjust Output path to source path"
- Set "Config->Output->File name generation->Output Filename Generation->Suffix" to "cleared"
- Set "Config->Output->Container Settings->General Settings-YStandard output container" to "mkv"
- Disable "Config->Output->Container Settings->Mkv Settings->Extract/Passthrough attachments"
- Enable "Config->Automation->Passthrough streams->Subtitle", in case some of the files have subtitles
- Set "Main->Handling->Video handling" to "passthrough"
- Set "Main->Handling->Audio handling" to "passthrough all"
- Enable "Main->Generate"
- Drag&Drop a folder (or all folders) into Hybrid, and wait till Hybrid analysed all files
- Generate jobs ("Main->Add To Queue")
- Start Queue ("Main->Start")
You then delete the old files (should be easy when you sort them by creation date) and rename the new files (tons of rename tools should be able to do this) and you archived your goal.
Cu Selurusers currently on my ignore list: deadrats, Stears555
for /r %%y in (*.mkv) do ( MKVMerge -o "%%~dpny-new.mkv" --no-attachments --no-track-tags --no-global-tags --disable-track-statistics-tags "%%~fy" if EXIST "%%~dpny-new.mkv" if ERRORLEVEL 0 ( DEL "%%~fy" REN "%%~dpny-new.mkv" "%%~nxy" ) )
Last edited by ndjamena; 16th Nov 2014 at 19:53.
I'm in my mid 50's and not a coder, not familiar with command line prompts and such. It's why I gravitate to the GUI tools. I see your code above but not sure how to implement in my situation. I like the GUI because I can also tick the box to remove some tags appearing in MKV files. I have not found a way to determine the contents of those mysterious tags.
I've changed it to remove tags as well.
It depends on which tags you're talking about, there are global tags, which describe what movie or episode is in the file and then there's track tags which as far as I'm aware didn't do anything until recently so if you have them they would have been added by MKVMerge. Since you had such nicely arranged attachments I'm assuming you must have global tags and since the Matroska tagging system isn't actually finished yet they can't be doing anything useful so you might as well get rid of them.
Take the code I posted above and paste it into a text file at your base video directory, rename the file "whatever.bat" then doubleclick it.
I'm not sure if you want to remove statistics tags or not, if not you can remove --disable-track-statistics-tags from the code. They may come in handy sometime in the future when MediaInfo is updated to make use of them but...
-edit- right, you may need to extend the MKVMerge command to include the full path to the program, assuming you even have MKVToolNix installed. I think Mosu stopped the installer from automatically adding the MKVToolNix directory to the path variable at some point.
Last edited by ndjamena; 16th Nov 2014 at 20:53.
Thanks ndjamena. I discovered I can drag the folder for an entire show onto the app....and it grabs all the MKV's in subfolders (Season 1, Season 2, etc.). This will be OK. I can do one show at a time, eventually cleaning all 181 TV shows...or use your script (Thank you).
The below image is an example of the "unknown" tags I often run into. Some have said these are important. However, I haven't found any use for them. I use Media Center Master with MediaBrowser as the front end. MCM collects all the artwork and creates separate "metadata" folder for each season. It includes posters and backdrops, and xml files that contain show details & mediainfo video details.
I guess a more modern way would be to embed all this info in the mkv. However, I often use MCM to update the xml's with more modern info as it becomes available...takes just a few seconds. Updating an mkv with new metadata I assume would take much longer, possibly remuxing the entire mkv.
This is how I have been removing tags.
They're the Track Statistics Tags, the developer of MKVToolNix admitted long ago that the way MMG displays them is awful and needs to change but he's re-writing MMG into MKVToolNix GUI and so won't be changing anything MMG does, ever.
You can keep them or remove them if you like, but future versions of MediaInfo (and similar programs) will use them to give more accurate information about the contents of the files. If you do this, it will be a tad more difficult for us to help you debug problems with your files in the future.
Tsmuxer, MediaInfo, MkvExtract, etc....none of these tools even display the tags for further review/processing.
Last edited by BJ12; 18th Nov 2014 at 19:28.
As far as I'm aware FFProbe is the best option for viewing the statistics tags, although it tends to list them each twice for some reason (something to do with languages, but they're all "eng" so...)
You can get to them with MKVExtract but it's not pretty, you can use mkvmerge -I as well but again it's kind of ugly and needs some interpretation.
MediaInfo can display all but the BPS tags, but it puts them in the wrong places far too often to be depended upon.
The tags are relatively new so nothing works with them properly yet and so far MKVMerge is the only program that adds them.
Hey jamena, all TV shows are cleaned up, thank you.
One last question. Is there a way to batch process using Propedit to save the MKV file name into the metadata as the "Title" field"? Example, if the file name is "Any Given Sunday (1999).mkv" then "Any Given Sunday (1999)" would be saved. I've been doing this manually using the Header Editor.
If done correctly, the file name would be saved in the "File/segment title:" field in the Global tab of MKVMerge.
It looks like JMkvPropedit might have one or two places to process adding the file name.
I have a batch file that does that, it's a bit complicated though. There are some characters that aren't allowed in the file system so have been replaced with other characters. My batch finds those characters and asks what I'd like to replace them with, remembers TV show names that I've already done and it also sets the track names as well.
This is the simplest version possible to do what you're asking is:
for \r %%y in (*.mkv) do ( mkvpropedit "%%~fy" --edit info --set "title=%%~ny" )
mkvpropedit. I tried dragging a MKV movie file on top of this bat file icon, which flashes a CMD prompt screen quickly......but the file name was not added to the metadata. This is the only way I know how to make a bat file work, drag something on top of the icon, guys at the MediaBrowser forum taught me this.
@if "%EMode%"=="" Set EMode=OFF @ECHO %EMode% SetLocal DisableDelayedExpansion Set "EXTLIST=*.mkv" Set "DoPop=" if [%1]== ( Set "Pattern=%EXTLIST%" CALL :START %1 ) :ARGS if [%1]== ( EndLocal pause goto :eof ) if NOT EXIST %1 ( SHIFT goto :ARGS ) Set "Pattern=%EXTLIST%" if "%~f1"=="%CD%" ( CALL :START %1 SHIFT goto :ARGS ) Type NUL pushd "%~f1" 2> nul if NOT "%errorlevel%"=="0" ( if NOT "%CD%\"=="%~dp1" ( pushd "%~dp1" Set "DoPop=1" ) Set Pattern="%~nx1" ) else ( Set "DoPop=1" ) CALL :START %1 if "%DoPop%"=="1" ( popd Set "DoPop=" ) SHIFT goto :ARGS :START Set "Count=0" for %%y in (%Pattern%) do ( CALL :Process_File "%%~fy" ) if "%Count%"=="0" ( for /d %%b in (*) do ( pushd "%%~fb" CALL :START "%%~fb" popd ) ) goto :eof :Process_File Set /a Count+=1 SetLocal DisableDelayedExpansion mkvpropedit "%~f1" --edit info --set "title=%~n1" EndLocal goto :eof
I tried and tried and could not get your most recent code to work. I was able to find the below code in another forum. It works, changed the metadata file name..but requires you drag the actual MKV file onto the bat icon. Dragging a folder onto this bat icon will not process the embedded MKV's.
@echo off &setlocal disabledelayedextension if "%~1"=="" echo File not found. :begin if "%~1"=="" (pause&exit /b) echo Changing "%~1" Title to "%~n1" "C:\Users\xyz\Downloads\Matroska MKV\MKVToolNix\ToolNix 7.3.0\mkvpropedit" "%~1" -s title="%~n1" echo ----- shift /1 goto:begin
I registered to this site only to thank you ndjamena, you are impressive!
I have been trying many apps but this code fixed it. Thank you very much if you are reading this!
mkvtoolnix\mkvpropedit.exe" (including the quotation marks) in place of mkvpropedit in order to define the path for mkvpropedit. Seems to work nicely.
Now, what code can I add and where in order to echo the file being altered? Currently, the batch file only echos the output:
The file is being analyzed.
The changes are written to the file.
I'd like the output to also echo the filename of the file that was altered.
Last edited by bocono; 13th Apr 2021 at 19:24.