Play video overlay over video not working in ffmpeg - ffmpeg

I am trying to play video over another video using ffmpeg. When i am trying to play video from starting then overlay video plays. But if i try to overlay video from n seconds it doesn't work
ffmpeg -i input.mp4 -i overlay.mp4
-filter_complex [1:v]scale=920:920[out],[out][0]overlay=0:0:enable='between(t\,4\,8)'[out]
-map [out] output.mp4
If i change between(t\,4\,8) to between(t\,0\,4) then overlay video works normally. It is not working for between(t\,4\,8). Please help how to solve it

Related

unable to add filter:a to ffplay

Im working on a video editing project and im using ffmpeg for video rendering
To play video before rendering i wana show it to user and i thought of using ffplay
ffplay -i C:/Users/thota/OneDrive/Desktop/VET/test.mp4 -filter:a "volume="1.0",atempo="1.0"" -vf "transpose=2,transpose=2,setpts=1/"1.0"*PTS,scale="1280*720"" -aspect 16:9 D:/videos.mp4output.mp4
but this is giving an error:
Failed to set value 'volume=1.0,atempo=1.0' for option 'filter:a': Option not found
ffplay only recognizes -vf/-af for video and audio filters respectively.
-af "volume=1.0,atempo=1.0"

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

ffmpeg merge two videos (not concatenating) is out of sync

I am trying to merge a video from my camera with a video via URL and show them [pip].
It shows great but the sound is out of sync.
my code is
ffmpeg -i input1.mp4 -i urlInput.mp4 -filter_complex "[1]crop=450:230:80:215,scale=iw/1.5:ih/1.5 [pip]; [0][pip] overlay=main_w-overlay_w-10:main_h-overlay_h-300; [1]volume=0.2[vol1]; [0][vol1]amix" -shortest output.mp4
there is nearly a one second delay between url-input(video and audio shows first) and the first input.
How can i get them to be synced?

FFPLAY shows video, but FFMPEG just shows black

I'm trying to record video/audio from a VIDBOX device using ffmpeg. Using Windows 10 and ffmpeg version N-86129-g1e8daf3, I can see and hear the video/audio fine when I execute
ffplay -f dshow -i video="VIDBOX NW07":audio="Microphone (VIDBOX NW07)"
but, I only record a black screen (and the correct audio) when I execute
ffmpeg -f dshow -i video="VIDBOX NW07":audio="Microphone (VIDBOX NW07)" -c:v libx264 out.mp4
What could be causing this to work in ffplay but not ffmpeg?
You are probably testing the output in a generic player. Add -pix_fmt yuv420p to force ffmpeg's output to a standard pixel format that all players can show.

using ffmpeg to convert gif to mp4 , output doesn't play on android

I just use the following command to convert a gif file to mp4 but the resulting mp4 file doesn't play in android default video player .
what did I wrong ?
is there any aditional steps should I take to produce android playable mp4 files ?
$ ffmpeg -f gif -i infile.gif outfile.mp4
my test gif file : Test Gif File
My desktop played the output.mp4 very well using VLC Media Player and also MX Player on my android device played the video file without any error.
Try this:
ffmpeg -i file.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" out.mp4

Resources