ffmpeg - loop MP4 for X Hours - sound missing - ffmpeg

Hey can someone help me with this script:
I want to loop the out.mp4 file up to 1 hous.
It is working it loop the out.mp4 up to 1 hour and save it as finalVid.mp4 but it has no sound. I checked the out.mp4 here the sound is still fine but after executing this script the sound is gone and i just have a 1 hour video.
ffmpeg -y -f lavfi -i \"movie=filename=out.mp4:loop=0, setpts=N/(FRAME_RATE*TB)\" -t 3600 finalVid.mp4
what i need to add here to get sound or someone can tell me other way to loop it up to 1h with ffmpeg?

Related

FFMpeg create thumbnail from HLS Live stream

I would like to create a thumbnail for HLS stream.
I am doing it already with mp4 files
like this ffmpeg -y -ss 00:00:10.000 -i file.mp4 -vframes 1 -vf scale=256:144 out.jpg
And it works great.
But when I try it with HLS live stream, it just spams
Opening 'liveX.ts' for reading.
Even though 10th second is in 'live1.ts'
Any solution to this? And I would like if duration is not in stream, just report error.
I know this is an old question, but I was working with FFMPEG today to see how this could be done with a live stream. I discovered that it can be done pretty easily.
Here is what I use...
ffmpeg.exe -y -i http://username:password#[hls feed ip address]/[path.m3u8] -s 800x450 -vframes 1 -f image2 -updatefirst 1 MyThumbnail.jpg
This is similar to the way you get a thumbnail from an rtsp stream, but seems to work faster.
I hope this helps someone.

Trying to concatenate very large video files with ffmpeg

I have about anywhere from 10-24 mp4 files that are about 1 hour in length each and when I try to concatenate them into one I am only left with a 1 hour output.mp4 where its only content is of that of the first 1 hour video I fed in with the audio completely choppy.
Has anyone tried to run ffmpeg to form a very large video file?
This is one of the ffmpeg commands I ran
ffmpeg -f concat -safe 0 -i videos.txt -an -filter:v "setpts=0.01*PTS" total_output.mkv

Adding loop video to sound ffmpeg

i start working with ffmpeg, and here my first doubt:
I have one sound file, example.mp3 (1 min duration).
I want add a loop video, example.mp4 ( x sec duration).
I want generate 1 min mp4 video and loop this video 3 times in this case, but this could be dynamic.
Its posible do this with ffmpeg ?
Thanks in advance
You can use
ffmpeg -i audio.mp3 -filter_complex movie=video.mp4:loop=0,setpts=N/FRAME_RATE/TB -shortest out.mp4
Due to a existing bug in shortest, output will be somewhat longer than the audio.

How to Loop Input video x number of time using FFMPEG?

I want to loop same video 4 times and output as video using ffmpeg.
SO I create code like this in ffmpeg.
ffmpeg -loop 4 -i input.mp4 -c copy output.mp4
but when i run it it give the error like this.
Option Loop Not Found.
how to do this withour error. Please Help Me
In recent versions, it's
ffmpeg -stream_loop 4 -i input.mp4 -c copy output.mp4
Due to a bug, the above does not work with MP4s. But if you wrap to a MKV, it works for me.
ffmpeg -i input.mp4 -c copy output.mkv
then,
ffmpeg -stream_loop 4 -i output.mkv -c copy output.mp4
I've found an equivalent work-around with input concatenation for outdated/bugged versions -stream_loop:
ffmpeg -f concat -safe 0 -i "video-source.txt" -f concat -safe 0 -i "audio-source.txt" -c copy -map 0:0 -map 1:0 -fflags +genpts -t 10:00:00.0 /path/to/output.ext
This will loop video and audio independently of each other and force-stop the output at 10 hour mark.
Both text files consist of
file '/path/to/file.ext'
but you must make sure to repeat this line enough times to keep the output satisfied.
For example, if your total video time is less than total audio time then video output will stop earlier than intended and the audio will keep playing until either -t 10H is reached or audio ends prematurely.

create thumbnails from big movies with FFmpeg takes too long

I'm using this shell command to make thumbnail from VIDEO_FILE from 123 second and save it to THUMBNAIL_FILE.
ffmpeg -i VIDEO_FILE -r 1 -ss 123 -f image2 THUMBNAIL_FILE
It works, but it is really slow for big movies. Is there any way to make it a little faster?
it has happened to me also, changing the argument order fixes this problem.
tested on a 1.4GB 90 minute mp4 video - took about 1-2 seconds. before that it took MINUTES...
try this:
ffmpeg -ss 123 -i "VIDEO_FILE" "THUMBNAIL_FILE" -r 1 -vframes 1 -an -vcodec mjpeg
Ffmpeg is not really good with creating thumbnails as I investigated. People recommend to use mplayer (by ffmpeg creators).
mplayer VIDEO_FILE -ss 00:10:11 -frames 1 -vo jpeg:outdir=THUMBNAILS_DIRECTORY
A small enhancement to Kirzilla's code: If you want to create PNG files (with compression), you can use the following code:
mplayer VIDEO_FILE -ss 00:10:11 -frames 1 -vo png:z=9:outdir=THUMBNAILS_DIRECTORY
This will probably create better thumbnails but of course with a larger size than JPEG.

Resources