Ah, I see what your problem is. You're running from the command line, not from a batch file. From the command line use single % signs rather than two.
+ Reply to Thread
Results 121 to 150 of 181
Last edited by jagabo; 14th Jul 2016 at 18:38.
I need some help in using an uncommon ffmpeg command -metadata, trying to change the metadata title to the same as the file name.
The reason is that my stand alone video player insists on showing strange clips titles rather than the actual files names from clips folders on my PC.
I can change the metadata title of an MP4 clip using:
ffmpeg -i clip_001.mp4 -metadata title="clip_001" -acodec copy -vcodec copy clip_001_new.mp4
Now I need to do that for several hundred clips to be titled clip_002..clip_003 etc and named sequentially as clip_002_new.mp4...clip_003_new.mp4 etc.
I have played with (for %%a in ".mp4") without success as I didn't know how to use a counter to produce the required sequential numbers in a batch file.
Any help would be greatly appreciated.
It seemed that no one had expressed any interest in solving my little problem.
I have been reading and discovering something about batch files.
So far, I have managed to change metadata titles in all of my clips by using
for %%x in ("*.mp4") do (ffmpeg -i "%%x" -metadata title=%%x -acodec copy -vcodec copy "newclips\%%x")
It took my awhile to understand this %% in batch files. This will change the clip title to the same as the file name and saved in a different folder.
The outcome was not pleasing to the eye or neat, all I had was non sequential files with names between 5 and 40 characters long
Now I need to figure out a neat way to rename my original clips to something like clip_0001.mp4, clip_0001.mp4 etc. then to apply my newly discovered batch file!
Perhaps someone will be interested this time?
Last edited by hydra3333; 20th Jul 2016 at 06:16. Reason: already answered
If you highlight a bunch of files with explorer and rename the they will come out with names like file (1).ext, file (2).ext, file (3).ext... And there are lots of file renaming utilities that work on batches.
I am aware of these renaming utilities. The problem is none of them could output padding zeros like Clip_0001, 0002, 0003 etc.
The reason I want these padding zeros is that my video player doesn't order the files sequentially, first it shows clip_1, then clip_10 instead of clip_2, then clip_100 instead of clip_3 as detailed below:
Just wondering now if there is a number_to_string manipulating function or a call within a batch file which can use an incremental counter within for %%x in ("*.mp4") do ?
Many thanks for any helping hands
Thanks Pandy for your suggestion. I will have a go at it.
Yes it did work for me. Thanks again
for %%a in ("*.mkv") do ffmpeg -i "%%a" -map 0:0 -c:v libx264 -b:v 500k -pass 1 -passlogfile "%%a" -f null /dev/null && \
for %%a in ("*.mkv") do ffmpeg -i "%%a" -map 0:0 -map 0:1 -c:v libx264 -b:v 500k -pass 2 -passlogfile "%%a" -c:a libopus -ac 2 -b:a 64k "New\%%~na.mkv"
Would this work for 2 pass?
I'm not sure if the construction with the && works. It would work if you did a new line, though then it would first do the first passes of all input files and afterwards do all the second passes. The end result would be the same.
Sometimes it hangs while doing the first passes for some reason. Second pass is fine.
Any way I can improve it?
Does it just hang or is there an error message?
Just hangs with last update in the CMD window: "frame=55206 fps=156 q=36.0 size= 110558kB time=00:10:40.07 bitrate= 492.2kbits/"
That was an example, it's random, sometimes the 1st file hangs and sometimes the 3rd or 4th (if there were 10 video files in the same folder as the ffmpeg.exe and .bat)
also, these flags are handy:
put just after the input file, prevents any unfortunate metadata being copied to the output file.
put just before the output .mp4 file (only useful for .mp4 files) it ensures the moov atom is placed at the front of the .mp4 file for "better sharing it via casting or the internet". or something like that.
-map_metadata -1 Did the trick, wow, it would have taken me forever to figure this out, had no idea metadata could have a negative influence. Thank you .
Well, strike me pink, I mentioned it only as a potentially handy side-issue rather than as a fix.
Never know your luck in the big world, eh ?
How to batch multiplex video and multiples subtitles track files with ffmpeg?
There is a ffmpeg code to Multiplex (one by one) the video & subtitles tracks into one .mkv container
Here's the Code:
ffmpeg -i "D:\Mux\Episode_06-010101.mkv" -i "D:\Mux\Episode_06-010101.ger.ass" -i "D:\Mux\Episode_06-010101.eng.ass" -i "D:\Mux\Episode_06-010101.spa.ass" -i "D:\Mux\Episode_06-010101.spala.ass" -i "D:\Mux\Episode_06-010101.fre.ass" -i "D:\Mux\Episode_06-010101.por.ass" -map 0:0 -map 0:1 -map 1:0 -map 2:0 -map 3:0 -map 4:0 -map 5:0 -map 6:0 -c:v copy -c:a copy -c:s copy -y "G:\Mux\convert\Episode_06-010101.mkv"
There are 30 videos files and each one has 6 subtitles, each subtitle is of different languages.
But how to batch mux many .mkv & subtitles files, there is a way do not need to input file names manually.?
Thanks in advance.
for %%a in (*.mkv) do ffmpeg -i "%%a" -i "%%~na.ger.ass" -i "%%~na.eng.ass" -i "%%~na.spa.ass" -i "%%~na.spala.ass" -i "%%~na.fre.ass" -i "%%~na.por.ass" -map 0:0 -map 0:1 -map 1:0 -map 2:0 -map 3:0 -map 4:0 -map 5:0 -map 6:0 -c:v copy -c:a copy -c:s copy -y "convert\%%~na.mkv"
Thank you, sorry not to have answered before, worked perfectly.
I tried to include other information, but it does not work, could you tell me what I'm doing wrong?
for %%a in (*.mkv) do ffmpeg -i "%%a" -metadata:s:v:0 title="%%na" -metadata:s:a:0 language=jpn -i "%%~na.por.ass" -metadata:s:s:0 language=por -i "%%~na.eng.ass" -metadata:s:s:1 language=eng -i "%%~na.spa.ass" -metadata:s:s:2 language=spa -i "%%~na.spa-mx.ass" -metadata:s:s:3 language=spa-mx -i "%%~na.fre.ass" -metadata:s:s:4 language=fre -i "%%~na.ger.ass" -metadata:s:s:5 language=ger -map 0:0 -map 0:1 -map 1:0 -map 2:0 -map 3:0 -map 4:0 -map 5:0 -map 6:0 -c:v copy -c:a copy -c:s copy -y "convert\%%~na.mkv?
"It does not work" is not a good error description. Post the log with the error message and/or say what is wrong with the output.
On first glance:
- "?" at the end instead of quote.
- you totally changed the command order of the other example. Your older example was ffmpeg [all input files] [all output options] [output file]. Why did you change the order?
I was just testing to see if the position of the commands interfered, but at any position I had the same error, So I ended up not posting the original command but one of the tests.
for 'is not recognized as an internal or external command, an operable program, or a batch fileCode:
for %%a in (*.mkv) do ffmpeg -i "%%a" -metadata:s:v:0 title="%%a" -i "%%~na.ger.ass" -i "%%~na.eng.ass" -i "%%~na.spa.ass" -i "%%~na.spa-mx.ass" -i "%%~na.fre.ass" -i "%%~na.por.ass" -map 0:0 -map 0:1 -map 1:0 -map 2:0 -map 3:0 -map 4:0 -map 5:0 -map 6:0 -c:v copy -c:a copy -c:s copy -metadata:s:s:0 language=ger -metadata:s:s:1 language=eng -metadata:s:s:2 language=spa -metadata:s:s:3 language=spa-mx -metadata:s:s:4 language=fre -metadata:s:s:5 language=por -y "convert\%%~na.mkv"
Thanks for your help.
Edit: I discovered what was the problem, the program I used to save the bat file, was inserting strange characters at the beginning of the file, these characters were not visible, I could only see them when using Dr. Batch.
Last edited by AlvoErrado2; 15th Nov 2016 at 10:42. Reason: Add Info
Hi carlrandall72 ,
Maybe it can help (?) .
Cheers .JE SUIS CHARLIE !!!
Last edited by Restricted; 21st Jun 2017 at 05:50.
i use plex so mp4 with h264 video and aac audio is great for me,but how do i make it to scan through all sub-folders and put the .mp4 file in the same folder as it was from as well as keep my existing filenames? also how do i make it produce a text log so i know what all it could/ couldnt do?
thanks for any help!
Last edited by Baldrick; 29th May 2013 at 02:54.
Thanks a bunch!
Edit: The MKV converting went A-Ok, but I did have a problem when converting my AVI though; kept getting the error " Unknown encoder 'libvo_aacenc' ". I read on another message board that you could simply switch out "libvo_aacenc" to "aac" in the given command line w/o any problems. To be honest though, I'm not an FFMPEG super user and in the past only used it to rip "Red vs. Blue" episodes from their website. And the files i'm converting are movies I watch off a computer using a 32" TV using computer speakers, so I haven't seen any real loss of quality with my simple change.
Edit 2: I might've spoken too soon on the time it'll take me to convert my movies.. the AVI take forever, not a few minutes like MKV files, but rather a few hours. At least the automation will cut down on time. But I suspect it'll take a month running my conversion 24/7.
Last edited by Anacron69; 28th Sep 2017 at 23:34.
Hi all, just for your information, I am developing an ffmpeg batch converter for Windows, so you can have the convenience of a windows graphical interface, file listing, drag and drop and batch processing, while keeping total control of ffmpeg parameters. Only for advanced ffmpeg users. Free and open source, you can find it here:
Direct download: https://files.videohelp.com/u/273695/FFbatch_setup.msi