how to Concatenate mp4 or mkv files using avconv - concatenation

I have multiple mkv files in a ubuntu directory.I have installed 'avconv' tool and its working fine. My aim is to simple concatenate all those files and produce a single mkv file.
I referenced so many articles and found that this command should serve the purpose:
avconv -i "concat:1-1.mkv|1-2.mkv|1-3.mkv" -c copy 1.mkv
However, when I run it, I get error:
concat:1-1.mkv|1-2.mkv|1-3.mkv: No such file or directory
I even tried it with mp4 files but still the same error.
Can anyone point out what wrong I am doing ?
Or there is any other approach ?

ffmpeg may turn out to be a better alternative. There is an entire wiki-page about concatenation of media files with ffmpeg.
Alternatively, try the mkvmerge utility:
mkvmerge -o 1.mkv 1-1.mkv + 1-2.mkv + 1-3.mkv

Related

Batch process all files in folder with ffmpeg?

I am trying to create a loop that will process all .mp4 (gopro clips) in a folder, and output each converted file with the same filename as the original + the _r suffix. I puzzled together the below from various sources but can't get it to work.
for i in *.mp4; do ffmpeg -i "$i" -vf "hflip,vflip" "${i%.*}_r.mp4"; done
Running the above gives the following error.
*.mp4: No such file or directory
What have I done wrong?
Yes, I am in the correct directory, and there are .mp4 files in in place.
Ffmpeg is installed and runs correctly.
Working in Mac terminal.

Regarding changing the file extensions of all files in a folder in ubuntu 14.04

I have a folder containing number of files with extensions in .xvg format and i need to change them into .dat format. How can i do that..?
What are the commands that i need to give such that all those files extensions that are in .xvg format are converted into .dat format [without the file name getting changed,(example., abc.xvg should be converted into abc.dat),only file extension should be changed].
Try this
rename 's/.xvg$/.dat/' *.xvg
For a test run you can use this command:
rename 's/.xvg$/.dat/' *.xvg -vn
-v means "verbose" and it will output the names of the files when it renames them.
-n will do a test run where it won't rename any files, But will show you a list of files that would be renamed.

Batch script to zip a folder using InfoZip

i'm a near complete beginner to batch scripting.
I'm currently learning how to create batch files. My goal is to compress a folder using exclusively InfoZip, add the date to the file name, and have that file copied to an USB memory stick plugged on H:\
The reason why i need to use InfoZip, even though it is a very old program, is because i need somthing that works even on Win95.
InfoZip is not installed, it is just unpacked in folder and ready to use.
It is possible to download InfoZip 3.0 from here:
https://sourceforge.net/projects/infozip/
Anyway, so far, the only thing i could come up with is this...
--------------------------------------
Title : Your folder will be zipped into an archive that will be copied on the USB memory stick plugged on your computer. Please DO NOT remove the memory stick during the operation.
#ECHO OFF
call d:\infozip\wiz.exe
pause
--------------------------------------
It just brings up the InfoZip window on the screen, but then i have absolutely no idea about how to make it zip a folder, add the date, and copy that zipped file to the USB.
All the regular commands meant for 7-zip or Winzip don't seem to work with InfoZip.
I could really use some help, please :)
Thanks!
Using the waybackmachine I was able to get the documentation for info-zip:
https://web.archive.org/web/20170829173722/http://www.info-zip.org/mans/zip.html#EXAMPLES
In contrary to what zip.exe shows, the syntax for zipping files is this:
zip -r zipfilename zipfilecontents
Example:
zip -r myzip.zip c:\myfolder\*.*
The -r parameter includes subfolders as well.
Problem is that the complete folder structure is included in the zip. I have not found a solution for this yet.
To solve the structure folder problem, add a cd command that will target the folder container which has inside your file or files. This before running the code proposed by Martien de Jong upside.
for example:
The path of my file is: cd C:\aa\B\file.txt
So the path you will put in the cd to target the folder container is: cd C:\aa\B
cd C:\aa\B
zip -r myzip.zip B\*.*
*Remember that this code will zip all the files included in B folder.

IBM i PASE tar - Excluding files or directories

I want to exclude some directories from an archive using the PASE tar command on an IBMi but the [-X Exclude File] option doesn't seems to work for me.
I tried using an exclude file that just contained a file name (/home/JSMITH/data/sub2/file2.txt) and then one that just contained a pattern (*.txt), and neither archive operation omitted anything.
Given the following directory structure:
/home/JSMITH/data
/home/JSMITH/data/sub1
/home/JSMITH/data/sub1/file1.txt
/home/JSMITH/data/sub2
/home/JSMITH/data/sub2/file2.txt
/home/JSMITH/data/sub3
/home/JSMITH/data/sub3/file3.txt
and the following command:
/qopensys/usr/bin/tar -cvf /home/JSMITH/test.tar -X /home/JSMITH/excludes.txt /home/JSMITH/data
The entire /home/JSMITH/data structure gets included in the resulting archive.
I have tried using the /home/JSMITH/excludes.txt file with either of these contents:
/home/JSMITH/data/sub2/file2.txt
or
*.txt
How does one exclude files/directories/patterns from the IBMi PASE tar command?
You need the full path in the exclude file.
I created mine via ls /home/JSMITH/data/*.txt > /home/JSMITH/excludes.txt
If you're doing it by hand, make certain you haven't got any trailing whitespace.
Also, I used Notepad++ when I created mine by hand. I found that the green screen edtf created an EBCDIC file with CRLF in it, and that didn't exclude for me.
IBM i 7.1

Using only ffmpeg, is it possible to consume a source GIF image and output a video that is a set length > one loop through the input GIF?

Let's say I have an 8 frame animated GIF that is 2 seconds long. I would like to build a video file (codec not important at this point) that is 30 seconds long that consists of the source GIF repeating over and over.
Is it possible to do this using only ffmpeg? Answers that use convert or some other pre-processing utility do not count [The reason being that I would like to use this on PandaStream, which does not have that utility]. Let's also assume that shell scripts are out of the question as well, though it can be multiple ffmpeg commands.
Things I have tried that did not work (though maybe I did them wrong, I'm not terribly familiar with ffmpeg):
Using the -loop_input, -loop_output options present in the ffmpeg docs. Using both ffmpeg 1.2 and 2.0, I get a Unrecognized option 'loop_[input|output]' error message. I might be using this wrong though since the error is about not recognizing the option, though the docs say it is deprecated.
-loop option. Does not seem to do anything with GIF -> Video. I think this flag and the above flag are related to generating animated GIFs as the output.
Concat. Doing something like:
ffmpeg -i "concat:image.gif|image.gif|image1.gif|image2.gif|image3.gif|image4.gif" image-long.gif
Results in a 16 frame gif (so two gifs are concatenated) which is progress, though the output gif is of much lower quality.
I'm a bit at my wits end here (I have tried many other permutations of the above concepts), I'm at the point now of 'poking it with a stick', hopefully someone out there has done this!
Is it possible? Yes.
Looking at How to concatenate (join, merge) media files, we can take the gif and transcode to mpeg streams (you could copy the first one twice):
ffmpeg -i image.gif -f mpegts image1.ts
ffmpeg -i image.gif -f mpegts image2.ts
ffmpeg -i image.gif -f mpegts image3.ts
then concatenate them, outputting as a gif
ffmpeg -i "concat:image1.ts|image2.ts|image3.ts" -pix_fmt rgb24 output.gif
Starting with an mp4 or similar seems to give better results; replace the first step with
ffmpeg -i image.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts image1.ts
and repeat for the other copies.
I create multiple copies of the same because if I try to concat: the same file multiple times (concat:image1.ts|image1.ts|image1.ts) it doesn't work.
Enjoy

Resources