How to extend audio file into a new duration - adding silent to beginning and ending of the audio - audio

I have a wav file named as a.wav.
Let's say it is 9.432 seconds.
I want to extend it to 13.321 seconds.
So I need to add silence to both beginning and end of video to 1.945 seconds.
The reason is I am working on a TTS application and I want to generate entire speech from a given subtitle srt or vtt file
So how can I do this perhaps with ffmpeg?
What command should I run?

Related

Getting Speaker labels or Splitting audio file that contains dialogue between two person?

I have audio file that contains dialogue between two person I want to split audio file into two audio files that contains dialogue of both in separate file.
I am want to use this audio files further for Speech to Text.
Or
Getting Speaker labels about the dialogue spoken by each of them.
IBM provides Speaker labels but I want something other than IBM.
Is there any way of splitting the audio file according to speaker?
I want to do this through some API or program.

Merging video to an audio file from in between or at a particular time

I am aiming to merge couple of media files.
So there is one audio file generated for say x minutes.And in between this duration multiple video files are generated at different timestamps (but all ends at or before that audio file ).
So I want to merge them such that different video files are merged with audio only at their respective times.
For eg -Following would be appearance of merged file, where A = audio stream and Vx = video streams
Start
2:00 A
2:07 A + V1
2:13 A + V2
2:17 A + V3
2:24 A
Finish
Should I use ffmpeg concatenation ? but ot sure it supports merging that starts at a particular time interval.
Thanks in advance !
I can use " -itsoffset " option in ffmpeg command to give offset for audio or video to start.
Credits:
How to combine a .mp4 video with a .wav audio with an offset in ffmpeg from command line?

Joining MP3's via commandline with background track

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!

Record screen and audio then generate to one video file in java.

I am writting a program as http://www.screencast-o-matic.com/. I used applet and import jmf.jar to my project. When I use it, it couldn't get anything capture devices so it couldn't capture audio and video.
I captured screen to video but it hadn't sound. I captured sound but it hadn't video. I use jmf to merger 2 stream to video file. But it error.
Everybody can help me to resol problem. Thanks your help.
You can use Xuggle-Xuggler http://www.javacodegeeks.com/2011/02/introduction-xuggler-video-manipulation.html API which is wrapper of FFmpeg command line tool. Both are open source.

continously add picture to video

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?

Resources