VideoHelp Forum
+ Reply to Thread
Results 1 to 19 of 19
Thread
  1. 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.
    Click image for larger version

Name:	New Picture (4).jpg
Views:	2215
Size:	109.5 KB
ID:	28569


    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 1.3.3.1 stated "Now it's also possible to add folders to the file list" but I can figure out how of if this works.

    Quote Quote  
  2. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    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.
    Quote Quote  
  3. Never used Hybrid for that, but what should work is:
    1. Start Hybrid
    2. Enable "Config->Path->Adjust Output path to source path"
    3. Set "Config->Output->File name generation->Output Filename Generation->Suffix" to "cleared"
    4. Set "Config->Output->Container Settings->General Settings-YStandard output container" to "mkv"
    5. Disable "Config->Output->Container Settings->Mkv Settings->Extract/Passthrough attachments"
    6. Enable "Config->Automation->Passthrough streams->Subtitle", in case some of the files have subtitles
    7. Set "Main->Handling->Video handling" to "passthrough"
    8. Set "Main->Handling->Audio handling" to "passthrough all"
    9. Enable "Main->Generate"
    10. Drag&Drop a folder (or all folders) into Hybrid, and wait till Hybrid analysed all files
    11. Generate jobs ("Main->Add To Queue")
    12. Start Queue ("Main->Start")
    This should create a new file (next to every existing file) which does not include the attachments any more.
    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 Selur
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  4. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Code:
    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.
    Quote Quote  
  5. Originally Posted by ndjamena View Post
    Since it's just a front end....I think you need to drag and drop the folder onto the window.
    Thank you so much jamena. I have been using the "+" icon that opens an explorer window requiring you select files. It doesn't allow you to select a folder, just individual files. You are correct, if I drag and drop a file onto that "Input" tab window, then processed the file, it reduced the file size. However, I don't see myself dragging 3,000+ files....from 181 TV show folders.

    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.
    Quote Quote  
  6. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    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.
    Quote Quote  
  7. 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.

    Click image for larger version

Name:	New Picture (5).jpg
Views:	5476
Size:	83.3 KB
ID:	28627


    This is how I have been removing tags.
    Click image for larger version

Name:	New Picture (6).jpg
Views:	4618
Size:	35.1 KB
ID:	28628
    Quote Quote  
  8. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    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.
    Quote Quote  
  9. Originally Posted by ndjamena View Post
    They're the Track Statistics Tags...You can keep them or remove them if you like.
    Thanks jamena. You are truly as sharp as they get. Yes, I have ToolNix 7.3 installed including the GUI's for MKVextract, PropEdit, and the preivew GUI for ToolNix (very cool). I wish I knew a easy way to see what these tags contain. I've tried 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.
    Quote Quote  
  10. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    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.
    Quote Quote  
  11. 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.
    Click image for larger version

Name:	New Picture (9).jpg
Views:	3964
Size:	70.1 KB
ID:	28711

    It looks like JMkvPropedit might have one or two places to process adding the file name.
    Click image for larger version

Name:	New Picture (7).jpg
Views:	4388
Size:	34.3 KB
ID:	28710
    Quote Quote  
  12. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    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:

    Code:
    for \r %%y in (*.mkv) do (
    	mkvpropedit "%%~fy" --edit info --set "title=%%~ny"
    )
    Which should work if placed in a .bat file.
    Quote Quote  
  13. Originally Posted by ndjamena View Post
    I have a batch file that does that, it's a bit complicated though.
    Professor jamena, thanks...now don't laugh...I'm not a coder. So I pasted that text into notepad, named and saved it as .bat file. I put the bat file in the folder that contains 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.
    Quote Quote  
  14. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Code:
    @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
    That should work.
    Quote Quote  
  15. Hi Jamena,
    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.

    for %%m in (*.mkv) do (
    echo Changing %%m Title to "%%~nm"
    "C:\Users\xyz\Downloads\Matroska MKV\MKVToolNix\ToolNix 7.3.0\mkvpropedit" "%%m" -e info -s title="%%~nm"
    echo -----
    )
    Quote Quote  
  16. batch expert Endoro's Avatar
    Join Date
    Dec 2013
    Location
    Bozen
    Search PM
    Try
    Code:
    @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
    http://ss64.com/nt/
    Quote Quote  
  17. Member
    Join Date
    Sep 2016
    Location
    Sulaimaniyah , Iraq
    Search Comp PM
    Originally Posted by ndjamena View Post
    Code:
    @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
    That should work.
    Thanks so much , It worked as I made a bat and put in a folder of around 20 file , they all got their titles removed in a blink
    Quote Quote  
  18. 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!
    Quote Quote  
  19. Originally Posted by ndjamena View Post
    Code:
    @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
    That should work.
    I added the line "c:\program files\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.
    Done.


    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.
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!