How can I remove several parts from video in command line? Or how can I select some intervals from video and create file from them?
I tried to convert video to mpg (mpg file was ok) and then use something like that:
mpgtx -j input.mpg [0:10-0:20] [0:42-0:52] [1:23-1:33] -o output.mpg
But result file was incorrect.
Thanks for answers!
Related
So I am wanting to create spectrograms using the FFMPEG for thousands of FLAC files in batch.
I am using the following for just one file.
ffmpeg -i audio-in.wav -lavfi showspectrumpic image-out.png
However, I would like to do this for all the files in a certain folder (\Desktop\FLACfiles) and don't want to keep changing the file name and the image output name.
I would like to somehow create a batch script in Windows 10 that automatically creates a spectrogram based on the filename.
I was trying to make it work but I don't have much experience via command line or programming in general. Not sure how to do achieve this.
Simply put, would like to use commands from a working directory containing FLAC files and create a spectrogram for each file matching the filename.
This worked for me using mp3 files but it wasn't fast. Someone may have a better solution. Try this as a bat file.
for %%a in ("*.mp3") do ffmpeg -i "%%a" -lavfi showspectrumpic "%%~na .png"
I have a large M4B file and a CUE file for it. I want to either split it into many M4B files, or split it into many MP3 files (former preferred).
I want to do this in the command line (OS X, but can use Linux if needed) and not install sketchy software. I have ffmpeg and can install other command line audio programs.
There is 2-step process which I did and it worked well.
Step 1 - Convert M4B to MP3
For this, you can use VLC Media Player (not sure how to do via command line so here are the GUI instructions).
Go to Media->Convert/Save
Add the M4B file, click "Save/Convert"
Under Profile, choose Audio-MP3
Select the destination (output) file
Press Start
...wait...but you should see a progress bar
Step 1.5 - Fix missing tags
Unfortunately, using VLC to convert the m4b to mp3 will remove all tags. So you might want to use something like puddletag (linux) to add the tags back in.
Step 2 - Split the MP3 using the .cue file
Once you have the MP3, use mp3splt (command-line)
The -c flag allows you to use the cue file for the split points.
Both of these are well worn programs (at least I have used both for years) so I do not think they are considered "sketchy."
I don't know how strict the CUE sheet format is, but assuming yours follows this general format:
TRACK 1 AUDIO
TITLE "Chapter 01"
INDEX 01 0:0:00
TRACK 2 AUDIO
TITLE "Chapter 02"
INDEX 01 22:56:01
then you can do this with ffmpeg and a perl one-liner.
user#host:~$ INFILE=input.m4b
user#host:~$ OUTPREFIX=output
user#host:~$ OUTEXT=mp3
user#host:~$ perl -ne 'sub p{printf(qq#"%s" -ss %f -to %f "%s_Chapter_%02d%s"\n#, "'"$INFILE"'", $_[0], $_[1], "'$OUTPREFIX'", $_[2], "'$OUTEXT'")}; if(/^\s+INDEX (\d+) (\d+):(\d+):(\d+)$/){$a=$b;$b=$4/60+$2*60+$3; p($a, $b, ++$c)if$b>0}; END{p($b, $b*100, ++$c)}' CUEFILE.cue | xargs -n 6 ffmpeg -i
The perl one-liner ignores all lines in the cue sheet but the INDEX ... lines and also ignores the first index, assuming it is zero. It prints out arguments for ffmpeg. xargs takes the right number of arguments (6 at a time, in this case) and calls ffmpeg once for each chapter (or track, or whatever).
This method can be used with a cue sheet to split up and convert any audio/video file provided ffmpeg accepts the input and output file formats.
I'm already taking advatage of two command line utilities. I'm using ffmpeg to convert m4a to mp3, and then I'm combining a few mp3's into one large one using mp3wrap. The resulting file is something like this:
BackgroundMusic.mp3 > Audio1.mp3 > Audio2.mp3
I need something more like
Audio1.mp3 > Audio2.mp3
|_____________________|
|
BackgroundMusic.mp3
To where the background music runs continuously in the background. Would be nice to be able to change the volume of each track too.
Does anyone know a command line program like mp3wrap but can also add in a background track?
I will not be able to use a GUI program such as Audacity, as all of this will be automated on the server.
Thanks!
You can do this with FFmpeg alone.
ffmpeg -i input_audio1 -i input_audio2 -i input_background_audio -filter_complex "
aevalsrc=0:d=10[s1];
[0:a]volume=volume=0.1[volume0];
[1:a]volume=volume=0.1[volume1];
[2:a]volume=volume=0.1[volume2];
[s1][volume1]concat=n=2:v=0:a=1[ac1];
[volume0][ac1]amix=inputs=2[amixed1];
[amixed1][volume2]amix=inputs=2:duration=first" output_audio
You need to use filter_complex to chain all the filters that you are going to use for adjusting the volumes, silent spaces, concat, etc. filters.
As the first step you can concatenate two audio files that you need to play one after the other. To do that I have first created and silent audio using aevalsrc filter with the same duration as the first audio clip. Then use concat filter to concatenate silent audio and the second audio.
To adjust the audio I have used volume filter. You can adjust the volume values accordingly. To mix the audios you can use amix filter. You can specify duration attribute to get the first input which is [amixed1] duration. With that option you can stop the whole audio with the duration of audio1+audio2 without play it for the full duration of background audio duration.
Hope this helps!
What we need to do is either, extract the audio from a group or singular Vob video file and convert it to a .Wav format. Now the process of actually extracting the audio and converting it can be done from a third party application however this application has to be activated from a batch or c# script. The media we are retrieving the vob files from always comes from the CD drive and will always be placed in the same folder location once the conversion is complete.
In shot I need a program or script that can be activated remotely to extract and convert vob files to .WAV.
Any help will be greatly appreciated.
I only install ffmpeg on Windows and put in cmd this command:
ffmpeg -i [VOB_file_route].VOB [WAV_file_output_route].wav
And that's all, just works.
To do somthing like this you will need to use VLC and cmd they work togeather well and will allow you to strip video and audio from a file easily
Every x minutes I grab an image from a network-cam. Now i want to add this picture to an existing video file - on the fly.
I don't want to keep numerous image files and then encode them once in a while with e.g.
mencoder mf://#${LIST} -mf type=jpg:fps=${FPS} ...
The video format/codec doesn't really matter, as long as standard tools (mplayer, ffmpeg, vlc, ...) can handle it.
Any ides or suggestions?
Thanks in advance!
One obvious way which should work (at least according to my first tests) is to just write the new jpeg image to the end of the video file - so the video is a mjpeg stream.
cat ${PIC} >> ${VIDEO}
This is an answer to my question, however i was looking for something consuming less space than the pictures stored each by its own would take up.
Other hints?