From time to time I receive several mkv's from a server I have. These mkv's are all part of the same recording, but they come in 1 minute chunks, and I don't want to have to take the time to stitch them together manually each time. Can this be done via an automated process in Windows?
EDIT: See my answer below for the solution that worked for me. The post by Endoro also looks promising.
I can give you an example:
#echo off &setlocal enabledelayedexpansion
cd /d "%sourcefolder%"
set "line="
for %%a in (*.mkv) do set line=!line! +"%%~a"
mkvmerge -o "output.mkv" %line:~2%
As I continued researching, I discovered a download page that also contained a review of mkvtoolnix (http://www.fosshub.com/MKVToolNix.html) that referred to some cmd commands he tested along with the standard GUI test. using the "mkvmerge --help" command, I was able to determine the appropriate command to stitch mkv files together. It looked something like this:
C:\Program Files (x86)\MKVToolNix>mkvmerge file1.mkv + file2.mkv --output C:\Users\User1\mkvfolder\combined.mkv
This stitched two mkv files together (that were located in the MKVToolNix folder), and puts the combined.mkv file in a different directory. It seemed to me that changing the source directories for either of the original mkv's (file1.mkv, file2.mkv) should be possible as well, so I next tried this:
C:\Program Files (x86)\MKVToolNix>mkvmerge file1.mkv + C:\Users\User1\Documents\file2.mkv --output C:\Users\User1\mkvfolder\combined.mkv
The above code merged file1.mkv (which I had placed in the mkvtoolnix directory) with file2.mkv (which I had located in a different directory), and placed the merged file (combined.mkv) in a third directory. The merged file ran cleanly in vlc, with no hiccups at the stitchpoint.
TL DR: go to http://www.fosshub.com/MKVToolNix.html, download MKVToolNix, and use the command line to merge mkv's.
You could try using AVIDemux with the --append arg. On this link there is also a batch file example script.
Related
I have a project folder in integrity client from which I want to get the entire folder structure. This folder structure should have all the folders and subfolders but no files inside. I don't even know this is possible or not.
I want this to run from command line. Any suggestion from UI perspective is also fine. Thank you.
I don't think this can't be achieved with only one command;
my suggestion is to createa a small script or batch, where you will use the SI VIEWPROJECT --RECURSE command and filter out the lines not ending with ".pj" (subprojects)
Not sure if I'm much too late, but I just stumbled across your question.
You could use the following command (simply type into Windows command line) to inventarize a downloaded sandbox:
$ TREE /F <path to Sandbox>
So in my case it'd be:
$ TREE /F D:\Sandbox\Name
You could even guide the output into a .txt file and postprocess it from there...
$ TREE /F D:\Sandbox\Name > D:\Output.txt
Edit: You would still have to take out all the filenames afterwards in your favourite programming language of choice (just check for the dash characters in front of folders and delete everything else...)
You can use the si viewproject command with filter by name activated to get only subprojects.
si viewproject --hostname={SI_HOST} --port={SI_PORT} --project={Project_Path} --filter=attribute:name=project.pj -R
Depends on your server configuration, the project.pj can be different.
I've been searching for an answer on the internet and can't seem to get a definitive one. I've been having an issue with getting a .bat file to accept more than 80 files at once for conversion and file look up with a batch script that links to a python script.
Here is an example of what I'm doing, it's easy enough...
#ECHO OFF
python "C:\myDirectory\Conversion_and_Excel_Extractor.py" %*
PAUSE
Again, this seems to work with 80 files drag and dropped unto the batch script but doesn't seem to work with more than that. Is there something I'm doing wrong?
they are located in their own directory. I would prefer to drag the
entire set of files, or the entire directory, into my batch file and
iterate over the files
that's possible:
drag the folder to your batch file and use
python "C:\myDirectory\Conversion_and_Excel_Extractor.py" "%~1\*"
As an alternative you could drag any one of the files to the batch file and use %~dp1 to get the folder and
python "C:\myDirectory\Conversion_and_Excel_Extractor.py" "%~dp1\*"
to process all files in this directory.
I'm trying to merge all *.pdf in directory :
gswin64c -q -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=Total_Files.pdf -dBATCH *.pdf
This is perfectly work for me on Linux, but when I run it on Windows
I'm getting **Error: /undefinedfilename in *.pdf.**.
Please could some one help me with this.
(My problem was practically exactly the same). My solution (with the help of previous answers) answers the original question slightly better (an actual MS-DOS example is below)
del filename.lst
for %%s in (C:\somefolder\some?wildcards*.pdf) do ECHO %%s >> filename.lst
gswin64c.... #filename.lst
To explain;
'>>' means append in MS-DOS - so firstly we delete file filename.lst
I read (just now in some other place) that %%s in MS-DOS batch files works (instead of %s). Obviously - one day the filenames may contain spaces (as mine did already) so better be safe and quote the filenames. So the better batch file is;
del filename.lst
for %%s in (C:\somefolder\some?wildcards*.pdf) do ECHO "%%s" >> filename.lst
gswin64c.... #filename.lst
Right now I just used this for inputting many EPS files - but many PDF files work fine too; as in the above example - I actually tested it with both - my result is a PDF with many EPS files in it - and many pages from multiple PDF files in one PDF (as per the question).
There was a previous question on this topic, the answer is the same, Ghostscript does not allow wildcards in the input filename, you must specify each file you want to have as input.
Why does it work on Linux ? Because the shell you are using expands '*.ps' to a full list of files before passing the command line to Ghostscript.
To do this in Windows you will need to execute a shell script, pipe the filenames to a file, then supply the file as an argument to GS.
EG, something like
for %s in (*.ps) do ECHO %s >> filename.lst
gswin64c.... #filename.lst
As alternative to the for loop
dir /b /o:n *.ps > filename.lst
gets the job done (/b to get the files only, /o:n to sort by name).
To solve the sorting problem completely, you could rename the first 9 files to 01->09, or open the output file in notepad and handle these few cases manually. But if you will have more than 100 files, this could be bothersome.
Sorry to stir up this one year old thread, which helped me with my problem, but I thought using 'dir' is easier, more flexible and doesn't need you to delete the file list before starting.
I used the follwoing statement to copy over files from one folder to another... but it does not copy over the subdirectory (and the files and folders under that subdirectory)
%sysExec copy "&driv.\&path1\*" "&driv.\&path2";
Any Solutions?
I don't think this is a SAS question. This would depend on your enviroment.
If you are on Windows, try xcopy
If you working in another environment, post additional info
I usually use a FILENAME PIPE for this, and then execute through a data step. The standard output is then captured in the data step. I've not got SAS available at the moment, but it would look something like this:
filename mycopy pipe """xcopy "&driv.\&path1\*.*" "&driv.\&path2\""";
data copydir;
infile mycopy;
input;
stdout=_infile_;
run;
You can check the data set's STDOUT variable for feedback on what happened.
If you're still running into trouble, then test the command you're running from the command line first and then transfer to your SAS code.
Try this . . .
%sysExec xcopy "&driv.\&path1\*.*" "&driv.\&path2\*.*" /s;
The /s option copies all subdirectories - provided they are not empty.
Using Windows, Mercurial, and the extdiff extension (for Mercurial). I was trying to set up extdiff to use WinDiff as an external diff tool, but I think I've narrowed the problem down enough to say that the trouble is before I'm even getting that far.
From what I understand of extdiff, it merely calls your cmd.winmerge program, and passes the necessary directories to it. I'm also working off of some assumptions outlined here (which may or may not be accurate; I'm just learning Mercurial):
http://bitbucket.org/tortoisehg/stable/issue/457/multiple-extdiff-threads-in-one-process-causes-side#comment-36216
which says:
The extdiff (visual diff) extension works like this:
1-Generate temporary directory(ies) for older changesets
2-run util.system( cwd=tempdir, "yourdiff tool dir1 dir2" )
util.system does:
2.1 store cwd;
2.2 cd tempdir
3-run your diff tool, wait for it to exit
4-cd oldcwd
5-Then finally extdiff deletes the temp directories.
The trouble that I'm having is that extdiff doesn't seem to be changing into the temp directory before proceeding, as it appears it is supposed to do in step 2.1 above.
In trying to isolate the problem, I wrote a batch file just to see what the cd was, what was being passed, and how exactly it was being passed. The batch file is as follows:
#echo off
echo %cd%
echo %1
echo %2
D:\Documents\apps\WinMergePortable\App\WinMerge\WinMergeU.exe %1 %2
I then set up extdiff to use this batch file as my extdiff program. This works, but I see that when it echoes %cd%, it's just c:\ , not c:\temp as expected. I've verified that extdiff is creating the temporary files in the proper temporary directories (as it's supposed to per step 1 above; something like c:\temp\extdiff.xxxxxx\someFolder.someChangesetID\file.ext), so I know it's SEEING those directories. It's just not properly changing into them before it's calling WinMerge, so when WinMerge is opened, it doesn't see the temp files (since it's not in the proper working directory).
That's basically where I'm stuck. I don't know where else to go from here. I thought of just putting
cd %tmp%
in my batch file, but that still doesn't grab the extdiff.xxxxx\ subdirectory which extdiff is creating the temp files in.
In summary: :-(
EDIT: Changing the batch file to
#echo off
echo %cd%\extdiff*
echo %1
echo %2
D:\Documents\apps\WinMergePortable\App\WinMerge\WinMergeU.exe %1 %2
seems to make it work (note changed second line), but it still seems a nasty hack to instead of how it's supposed to work. :-\
EDIT: Here is my Mercurial.ini file:
[ui]
username = Tim Skoch <my_real#email.address>
editor = D:\Documents\apps\Notepad++\notepad++.exe -multiInst
[extensions]
hgext.graphlog =
hgext.extdiff =
[extdiff]
cmd.winmerge = d:\Documents\apps\mercurial\diff_winmerge.bat
I can confirm that extdiff will change to a temporary directory before starting your diff program. You can use --debug to see this. Here I'm using true as the diff program (it just exist immediately):
$ hg extdiff -p true --debug
making snapshot of 2 files from rev 18480437f81b
a
b
making snapshot of 2 files from working directory
a
b
running "'true' 'foo.18480437f81b' 'foo'" in /tmp/extdiff.IJ9clg
cleaning up temp directory
The two arguments for the diff program are directories: a snapshot directory for the old versions and one for the new versions. They are inside the /tmp/extdiff.IJ9clg temporary directory.
One confusing point is that the arguments for the diff program are different depending on the number of modified files. With just one modified file, there is no need to create a
snapshot of the working copy. So if a is the only modified file, you'll see
$ hg extdiff -p true --debug
making snapshot of 1 files from rev 18480437f81b
a
running "'true' '/tmp/extdiff.mUlnP_/foo.18480437f81b/a' '/home/mg/tmp/foo/a'"
in /tmp/extdiff.mUlnP_
cleaning up temp directory
Here the diff program was started with two files as arguments. As described in hg help -e extdiff, you can use some variables to build the command line. The default corresponds to $parent $child.
You say that WinMerge "cannot find the files correctly". There are other questions and answers on SO about WinMerge and they seem to have it working just fine. Maybe you can try their command line options.