I have a working script that plays a different audio every 45 minutes.
The audio files change on a daily basis, so i cant manually fade them in/out in Audacity.
In the script, i have the following line:
ffplay -i /home/user/Ringtone1.mp3 -ss 00:00:7 -t 20 -nodisp -autoexit
But every time, the audio cuts abruptly after 20 seconds, which isn't very ear-pleasing.
I want to make the audio fade in from 0 to max in 5 seconds and then fade out from max to 0 in 5 seconds (at the end of the 20 seconds).
How can i do that?
Related
I've looked at this question: ffmpeg: How to repeat an audio "watermark" and I was able to create a watermarked audio file, repeating every x seconds.
However, I need a small variation to the behaviour and I haven't been able to figure it out myself - how can I repeat the watermark every x seconds, AFTER the original audio clip has played for at least x seconds? In other words, I want the watermark to be audible at 10 seconds, 20 seconds and 30 seconds for a 33 second long clip, and currently it's also audible at 0 seconds (i.e. start of the clip).
Thanks in advance!
Assuming you have followed step 1 in the linked answer. use
ffmpeg -i main.mp3 -filter_complex "amovie=beep.wav:loop=0,asetpts=N/SR/TB,adelay=10s:all=1[beep];
[0][beep]amix=duration=shortest,volume=2" out.mp3
The start of the beelp is delayed by 10 seconds. Use a recent git build of ffmpeg, else all=1 won't be recognized and delay for all channels will have to be set.
I have multiple video's consisting of a m3u8 file in combination with a bunch of .ts files (10 seconds a piece). I would like to be able to copy pieces from these video's in order to present only the wanted piece of a longer video to the user. The video's range from 30 minutes to 3 hours, and the piece to copy from the video can be up to 1 hour long.
The FFMPEG command I use for this:
ffmpeg -ss 00:00:01 -i /media-storage/3/308/video.m3u8 -to 00:10:25 -hls_time 10 -start_number 1 -hls_playlist_type vod -c copy /media-storage/test/video.m3u8
There does not need to be any re-encoding or converting, but the operation above takes about 30 seconds. (which is only 10 minutes)
Is there any way to improve this command to make it a bit quicker? The cutting does not need to be frame precise.
I use the latest FFMPEG release and my OS is CentOS 8
I've found the issue with the poor performance in the above command.
Turns out the SMB NAS where my data is stored is not very fast when copying data. When I use the above command on the local machine the response is almost instant.
I've a scenario in which I need to modify certain portions of audio file.Currently,I'm able to add silence to the audio file at specific portions through FFMPEG audio filter -af.But is there something that can replace particular portions of audio with beep sound and the duration of the file should be same after the process?
Eg: Input.wav,I want to add beep of 10s-15s(i.e.,5 seconds) to the file
Replace audio with beep from 10 to 15 seconds:
ffmpeg -i input.wav -filter_complex "[0]volume=0:enable='between(t,10,15)'[main];sine=d=5:f=800,adelay=10s,pan=stereo|FL=c0|FR=c0[beep];[main][beep]amix=inputs=2" output.wav
sine - makes beep sound
adelay - adds a delay to position the beep
pan - one of many methods to convert the beep from mono to stereo
amix - mixes the beep into the main audio
If the beep occurs almost immediately at 10 milliseconds instead of at 10 seconds then your ffmpeg is old and you have to declare milliseconds instead of seconds: adelay=10000.
I am trying use some images and audio to create video using mencoder.
But my audio file could be much longer.
Example:
5 images.
fps: 1
desired video length: 5 seconds
audio file length is: 20 seconds.
mencoder mf://*.jpg -mf fps:1.0 -oac mp3lame -audiofile myaudio.mp3 -ovc lavc vcodec=mpeg4 -o myvideo.mpeg
This produces a video that is:
20 seconds long (as long as audio file length).
The image slide show ends at 5 seconds, after that there is only audio playing (from 6th to 20th second).
How can i make mencoder to generate video of only duration where video stream exists. In this case end the video at 5 seconds.
ffmpeg has a -shortest option for exactly this kind of use case. But i cannot find equivalent of that in mencoder.
I posted this as comments under this related thread. However, they seem to have gone unnoticed =(
I've used
ffmpeg -i myfile.avi -f image2 image-%05d.bmp
to split myfile.avi into frames stored as .bmp files. It seemed to work except not quite. When recording my video, I recorded at a rate of 1000fps and the video turned out to be 2min29sec long. If my math is correct, that should amount to a total of 149,000 frames for the entire video. However, when I ran
ffmpeg -i myfile.avi -f image2 image-%05d.bmp
I only obtained 4472 files. How can I get the original 149k frames?
I also tried to convert the frame rate of my original AVI to 1000fps by doing
ffmpeg -i myfile.avi -r 1000 otherfile.avi
but this didn't seem to fix my concern.
ffmpeg -i myfile.avi -r 1000 -f image2 image-%07d.png
I am not sure outputting 150k bmp files will be a good idea. Perhaps png is good enough?
Part one of your math is good, the 2 minutes and 29 seconds is about 149 seconds. With 1000 fps that makes 149000 frames. However your output filename only has 5 positions for the number where 149000 has 6 positions, so try "image-%06d.bmp".
Then there is the disk size: Do your images fit on the disk? With bmp every image uses its own size. You might try to use jpeg pictures, they compress about 10 times better.
Another idea: If ffmpeg does not find a (reasonable) frame rate, it drops to 25 or 30 frames per second. You might need to specify it. Do so for both source and target, see the man page (man ffmpeg on unix):
To force the frame rate of the input file (valid for raw formats
only) to 1 fps and the frame rate of the output file to 24 fps:
ffmpeg -r 1 -i input.m2v -r 24 output.avi
For what it's worth: I use ffmpeg -y -i "video.mpg" -sameq "video.%04d.jpg" to split my video to pictures. The -sameq is to force the jpeg in a reasonable quality, the -y is to avoid allow overwrite questions. For you:
ffmpeg -y -r 1000 -i "myfile.avi" -sameq "image.%06d.jpg"
I think, there is a misconception here: the output of a HS video system is unlikely to have an output frame rate of 1000 fps but something rather normal as 30 (or 50/60) fps. Apart from overloading most video players with this kind of speed it would be counterproductive to show the sequence in the same speed as it was recorded.
Basically: 1 sec # 1000 fps input is something like 33 sec # 30 fps output.
Was the duration of the scene recorded really 2:29 min (resulting in a video ~82 min at normal rate) or took it about 4.5 sec (4472 frames) which is 2:29 min in normal playback?
I tried this on ubuntu 18.04 terminal.
ffmpeg -i input_video.avi output_frame_path_images%5d.png
where,
-i = Input