ffmpeg make video from audio, img and vtt subtitles - ffmpeg

I'm trying to make a video with image audio file and vtt files, that's my command
ffmpeg -i F:\speech\media/waves/to_be_translated/python_example_test_GUyqHnh.wav -loop 1 -i F:\speech\waves/img.jpg -vf -filter_complex subtitles=F:\\speech\\media/typedVideos/combinedVideoTyped/zcjgtmrdlscqzina\\subtitles.vtt -map -shortest F:\speech\media/typedVideos/combinedVideoTyped/zcjgtmrdlscqzina\exported-video.mp4
but it gives this error:
Output #0, webvtt, to 'subtitles=F:\\speech\\media/typedVideos/combinedVideoTyped/zcjgtmrdlscqzina\\subtitles.vtt':
Output file #0 does not contain any stream
what am I doing wrong?

You have to tell ffmpeg what to do with the inputs.
There are many ways to skin a cat, here is one simplistic way.
ffmpeg -i input.jpg -f lavfi -i color=size=640x480:color=black -i 'input.wav' -filter_complex "[1][0]overlay[out];[out]subtitles='input.srt'[vid]" -map [vid] -map 2 -shortest -preset ultrafast output.mp4
We specify 3 inputs, the image, a Libavfilter input virtual device and the audio.
The virtual device generates a black video of a specified size.
The image is overlaid on top of the video, with the subtitles placed on the resulting output.
Finally we map the finished video with the audio into the final output file, an .mp4 which finishes when the shortest element going into it finishes, which will be the audio in this case, as the image and the video have no length per se.

Related

How to combine a video with audio from another video using FFMPEG?

I have two videos of the same length that I'd like to combine. Video A has audio, video B does not. I'd like to take the audio from video A and put it onto Video B. I'd like to do this with FFMPEG, but I can't figure out the arguments I need? Should I use map?
There's a lot of questions about combining a video with audio, but not two videos.
Do I maybe need an intermediate step of converting my original video to audio?
I have tried using this FFMPEG command, and a couple of variations. All of the resulted in just Video A (the one with audio) being the output.
ffmpeg -i videoB.mp4 -i video A.mp4 -c:v copy -c:a aac output.mp4
Try this as a starter
ffmpeg -i videoB.mp4 -i video A.mp4
-filter_complex [0:v][1:a][1:v][1:a]concat=n=2:v=1:a=1[vout][aout]
-map [vout] -map [aout] -c:v h264 -c:a aac output.mp4
You must reencode though.

FFMPEG overlay video over image using movie filter resulting video with no sound

I want to overlay srinked video on the top of single image.
I use movie filter to do that. like this
ffmpeg.exe -loop 1 -i Coronavirus00000000.jpg -vf "movie=C\\:/\Users/\Toshiba/\Pictures/\test vcp/\shopi pro.mp4,scale=1180:-1[inner];[in][inner]overlay=70:70:shortest=1[out]" -y out.mp4
It's work. but the problem, the audio from video is removed. The final video out.mp4 has no sound, even though the original video has.
I have read answer on this threat FFMPEG overlaying video with image removes audio
That recommend to Change into ...[padded]overlay=0:0" -y ... Or add -map 0:a
But I don't understand how to implement that answer into movie filter
Please notice inputs/sources you have:
an input image ("Coronavirus00000000.jpg")
a movie source which by default selects a video stream
so you don't have any audio input stream selected/opened. To do so I'd recommend open every file as a standard ffmpeg input (-i <file>) and then configure a complex filtering graph that utilizes them.
In your example that would be:
ffmpeg -loop 1 -i Coronavirus00000000.jpg -i C\\:/\Users/\Toshiba/\Pictures/\test vcp/\shopi pro.mp4 -filter_complex "[1:v]scale=1180:-1[inner];[0:v][inner]overlay=70:70:shortest=1[out]" -map '[out]' -map 1:a -y out.mp4
where:
-i Coronavirus00000000.jpg opens your image file as input #0
-i C\\:/\Users/\Toshiba/\Pictures/\test vcp/\shopi pro.mp4 opens your video file with video and audio streams as input #1
[1:v]scale=1180:-1[inner] scales the input's #1 video stream
[0:v][inner]overlay=70:70:shortest=1[out] overlays the scaled video onto input's #0 video stream
-map '[out]' selects overlayed video stream (tagged as [out]) for output video stream
-map 1:a selects input's #1 audio stream for output audio stream

Converting a large number of MP3 files to videos for YouTube, each using same the JPEG image

I am looking for a way to convert large number of MP3 files to videos, each using the same image. Efficient processing time is important.
I tried the following:
ffmpeg -i image.jpg -i audio.mp3 -vcodec libx264 video.mp4
VLC media player played the resulting video file with the correct sound, but a blank screen.
Microsoft Media Player played the sound and showed the intended image. I uploaded the video to YouTube and received the message:
"The video has failed to process. Please make sure you are uploading a supported file type."
How can I make this work?
Create video:
ffmpeg -framerate 6 -loop 1 -i input.jpg -c:v libx264 -vf format=yuv420p -t 00:10:00 video.mp4
The duration (-t) should be ≥ the MP3 with the longest duration.
Now stream copy the same video for each MP3:
ffmpeg -i video.mp4 -i audio.mp3 -map 0:v -map 1:a -c copy -movflags +faststart -shortest output.mp4
Some notes regarding compatibility:
MP3 in MP4 does not have universal support, but will be fine in YouTube. If your target players do not like it then add -c:a aac after -c copy to output AAC audio.
If your target player does not like it then increase the -framerate value or add the -r output option with an appropriate value, such as -r 15. Again, YouTube should be able to handle it.

Create muted video and black screen video with FFmpeg

I'm trying to use FFmpeg to generate the following from a local mp4 file:
A copy of the original video with no audio
A copy of the original video with audio but without visuals (a black screen instead). This file also needs to be in mp4 format.
After reading through the documentation I am struggling to get the terminal commands right. To remove the audio I have tried this command without any success:
ffmpeg -i file.mp4 -map 0:0 -map 0:2 -acodec copy -vcodec copy
Could anyone guide me towards how to accomplish this?
Create black video and silent audio
Use the color and anullsrc filters. Example to make 10 second output, 1280x720, 25 frame rate, stereo audio, 44100 sample rate:
ffmpeg -f lavfi -i color=size=1280x720:rate=25:color=black -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -t 10 output.mp4
Remove audio
Only keep video:
ffmpeg -i input.mp4 -map 0:v -c copy output.mp4
Keep everything except audio:
ffmpeg -i input.mp4 -map 0 -map -0:a -c copy output.mp4
See FFmpeg Wiki: Map for more info on -map.
Make video black but keep the audio
Using the drawbox filter.
ffmpeg -i input.mp4 -vf drawbox=color=black:t=fill -c:a copy output.mp4
Generate silent audio
See How to add a new audio (not mixing) into a video using ffmpeg? and refer to the anullsrc example.
To remove the audio you can use this:
ffmpeg -i file.mp4 -c copy -an file-nosound.mp4
notice the -an option
-an (output)
Disable audio recording.
To keep audio but "replace" the video with a black screen, you could do this:
ffmpeg -i file.mp4 -i image.png -filter_complex overlay out.mp4
image.png is a black wallpaper that is placed on top of the video, but there should be better ways of full removing the frames, you could either extract the audio and later create a new video with the audio as a background

ffmpeg audio property is blank in output video

Here's what I have to do,
I want to convert two different images in different video file (ex: convert a.jpg into a.avi and b.jpg into b.avi).
I am trying to generate video (.avi) from image file. Video file is generated successfully but I can't see the audio properties when I right click on video and see details tab in property.
Then I have one video file (.avi), using ffmpeg concat function, I am concating these three video files (a.avi, middle.avi which I already have, b.avi).
After this, I am getting file output.avi but audio is not there in outout.avi file. I have middle.avi which already contains audio.
Here's my concat command,
ffmpeg -i "concat:a.avi|middle.avi|b.avi" -vcodec copy 103_n4_2.avi
I am trying to generate video (.avi) from only one image file. Video file is generated successfully but I can't see the audio properties when I right click on video and see details tab in property.
Here's my command to convert image to video:
ffmpeg -loop 1 -i bCopy.jpg -t 30 -q:v 0 -r 24 output_a.avi
PS: a.avi and b.avi (which I have generated from images does not contain audio) but only middle.avi contains the audio.
I think the audio track is completly ommitted. I was not able to test it but it seams you need to map the audio stream manually to the output and delay it by the the length of your first image.
ffmpeg -i middle.avi -itsoffset 1 -map 1:1 -i "concat:a.avi|middle.avi|b.avi" -map 0:0 -vcodec copy -acodec copy 103_n4_2.avi
Thanks for the help but I have found the solution of this perticular issue,
Here are the steps:
1. Generate blank mp3 of the first slide duration.
- ffmpeg -f lavfi -i aevalsrc=0 -t 31 -q:a 9 -acodec libmp3lame out.mp3
2. Trim audio from middle slide
- ffmpeg -i middle.avi -acodec copy middle.mp3
3. Concat this two audio
- ffmpeg -i "concat:out.mp3|middle.mp3" -acodec copy 103_n4_2.mp3
4. Now concat audio and video(that we've cgenerated by concatenation)
- ffmpeg -i 103_n4_3.avi -i 103_n4_2.mp3 -c:v copy -c:a aac -strict experimental 103_n4_5.avi

Resources