Extracting thumbnails with FFMPEG is super slow on large video files? [duplicate] - performance

This question already has answers here:
Fastest way to extract a specific frame from a video (PHP/ffmpeg/anything)
(2 answers)
Closed 7 years ago.
I extract thumbnails from a .MOV file using FFMPEG on Linus (Debian 64bit).
The file I extract the thumbnail from is about 430 Megabytes large.
I use the following command to do so:
ffmpeg -i 'largeVideoFile.mov' -ss 00:14:37 -vframes 1 'thumbnail.jpg'
It takes well over 3 minutes for a single frame to be extracted.
How can I speed it up?

I found this article, which suggests that one should use fast seeking to increase performance by simply defining -ssin front of -i rather than the other way around.
So my command now looks like this:
ffmpeg -ss 00:14:37 -i 'largeVideoFile.mov' -vframes:v 1 'thumbnail.jpg'
Notice that the arrangement of the parameters have been changed,
starting with -ssand time, followed by -i and source file, and finally -vframes:v, 1 and the destination path.
The time is down to about 1 second which is nice.

Related

FFMPEG - Strange issue with video copy

I'm new here.
I have a set of TIF frames that equal 1 minute and 25 seconds of a video.
I'm attempting to copy the frames without re-encoding using the "-c:v copy" function to avoid visible quality loss for a process I'm doing on my side. The command is as follows:
ffmpeg -r 23.977 -i %06d.tif -c:v copy out.mkv
However for some reason, the timing does not seem to be accurate and the video is slightly desynced from the original, ending at 1 minute and 22 seconds instead.
When I use the following command:
ffmpeg -r 23.977 -i %06d.tif out.mkv
It comes out with the proper timing at 1 minute and 25 seconds, however, I did not appreciate the quality loss that came with it.
Is there a workaround to this or is there something I'm missing?
I used both Command Line and Windows Terminal.
In general, it would make sense to transcode when you go from tiff to video format. (I'm surprised it actually works.) You can set encoding quality to your own liking. See [this FFmpeg Wiki article[(https://trac.ffmpeg.org/wiki/Encode/H.264).

Realtime Muxing of videos

My problem basically comes from me having 2 different streams for videoplayback and having to mux them realtime in memory. One for video, and another for audio.
My goal is to create a proxy which can mux 2 different webm streams from their URLs, while supporting range requests (requires knowing the encoded file size). Would this be possible?
This is how I mux the audio and video streams manually using ffmpeg:
ffmpeg -i video.webm -i audio.webm -c copy output.webm
But, this requires me to download the video fully to process it, which I don't want to do unfortunately.
Thanks in advance!
If you are looking for this to work in go you can look into
github.com/at-wat/ebml-go/webm
This provides a BlockWriter interface to write to webm file using buffers; You can see the test file to checkout how to use it
https://github.com/at-wat/ebml-go
Checkout ffmpeg pipes.
Also since you have tagged go - i'm assuming you will use os/exec - in which case also checkout Cmd.ExtraFiles. This lets you use additional pipes(files) beyond just the standard 0, 1 and 2.
So let's say you have a stream for video and one for audio piping to 3 and 4 respectively. The ffmpeg bit of your command becomes:
ffmpeg -i pipe:3 -i pipe:4 -c copy output.webm

Using FFMPEG I get an error when trying to insert a fade after about 35 mins in a long video - is this possible?

I have a source video that is an hour long from which I want to extract a couple of minutes towards the end and add a video fade in at the start of the cropped section.
Using FFMPEG, I'm specifying the following command:
ffmpeg -i MyLongVideo.mp4 -q:v 0 -y -ss 00:50:00.000 -to 00:52:00.000 -vf "fade=t=in:st=3000.0:d=1.0, scale=iw*min(1280/iw\,720/ih):ih*min(1280/iw\,720/ih),pad=1280:720:(1280-iw)/2:(720-ih)/2" ./testoutput.ts
This is intended to crop from the source video from 50:00.000 to 52:00.00 and fade in from the 50th minute for 0.5 seconds (so at 3000 seconds in - st=3000.0).
This command that we build programmatically, works on shorter videos or when you crop from before about 35 minutes. For this longer video though I get an error that says:
[fade # 0000025399981e80] Value 3000.000000 for parameter 'st' out of range [0 - 2147.48]
The 2147.48 is around the 35 minutes in seconds which explains why this command works for shorter videos or on crops earlier than 35 minutes.
I've seen a number of other issues with FFMPEG talking about this 'magic' 2147.48 number with parameter values. Is this some sort of hard limit?
Is there a way to do what I want to do? I could do this in two passes - extract the section of video and then add the fade, but I'd rather do it in one command if possible - and it works for shorter/earlier crops.
Get a ffmpeg build from after Nov 12 2018 or before Oct 7 2018. There was a regression in the builds in between.

ffmpeg - automatically chopped?

I have an ISO file that I would like to encode it out to mp4 in parts so it's easier to upload to youtube. I am not sure how it handles with chapters etc in this iso file. I have tried
ffmpeg -i file.iso newfile.mp4
which works great however it's one large file.
I have google and read some where that says if you put a % within the output file, it should automatically give you parts of the video based on the -t you set, so I went ahead and did this
ffmpeg -i file.iso -t 30 newfile%.mp4
however, the above does not work as it only give me 30 seconds with the file name: newfile%.mp4
Thanks for your time and hoping I can get some help with this. Thank you in advance!
You can use -t and -ss in conjunction to do this with a script.
Here is one: http://grapsus.net/blog/post/A-script-for-splitting-videos-using-ffmpeg

FFMPEG not able to extract thumbnails of images larger than .6 MB

ffmpeg.exe -i "imageLarge.jpg" -y -f mjpeg -s 72x92 -vframes 1 -an thumbnail7292.jpg
We are using this command to generate thumbnails of image files using FFmpeg but found that it is not able to generate thumbnails of files larger than .6 MB can somebody suggest something on this.
It isn't clear what exactly the problem with ffmpeg is, but in any case I'd recommend using the convert utility from imagemagick. It's much simpler:
convert imageLarge.jpg -resize 72x92 thumbnail7292.jpg
If you give a description of the actual error, then more people will be able to help you.
EDIT
The OP's error is:
swScaler: Compile time max width is 2048
change VOF/VOFW and recompile
Cannot get resampling context
It's quite clear what the problem is. Your JPEG files are too big for your current build of ffmpeg. You will have to recompile ffmpeg or get a newer version if you want to work with larger images.
This is from src/libswscale/swscale_internal.h (version: FFmpeg SVN-r26402).
#if ARCH_X86
#define VOFW 5120
#else
#define VOFW 2048 // faster on PPC and not tested on others
#endif
That's the file you need to edit if you want to change the limits.
What version of ffmpeg are you using? This problem seems to have been addressed over a year ago.
If you don't want to rebuild ffmpeg, you could just use convert, like I originally advised.

Resources