ranger-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ranger-users] Video files: thumbnail previews


From: niku
Subject: Re: [Ranger-users] Video files: thumbnail previews
Date: Tue, 30 Jul 2013 10:57:12 +0530
User-agent: Mutt/1.5.21 (2010-09-15)

Joshua, I had not read your mail before making a reply in another
thread. Did you try the following?

        ffmpeg -ss 10 -i INPUT_FILE -vframes 1 -y OUTPUT.png

This works blazingly fast on my system. (Less than 0.1 second for the
files I tried.)

I gather that the difference is because in some cases all frames upto
the 10th second are decoded, and in some they are not. FFmpeg looks
like black art. You have to know precisely what you want and how
ffmpeg works, but once you know these things, you can do almost
anything with your video and audio files!

You use -ss _after_ the input file, and that makes ffmpeg read the
file to go frame by frame to construct what would be seen at 10th
second exactly. That is precise, but that is not what we want. Since
we don’t need accuracy, we can use -ss _before_ the input file, which
just looks for keyframes†, and seeks for the 10th second as, for
example, mplayer would do. This is much faster, as no preceding frames
are decoded. (btw, I learnt that mplayer and ffmpeg originate from the
same code base, and even now share much of the code.)

See `Nicolas George-2'’s first message on this page:
http://ffmpeg-users.933282.n4.nabble.com/Reducing-seek-time-when-start-time-offset-ss-is-large-td1460307.htmlhttps://en.wikipedia.org/wiki/Key_frame

> >  On 07/28/2013 08:53 PM, Joshua Landau wrote:
> It's still slow to seek, but there's a faster way (!). Yes, I have beaten
> the Gods¹ and climbed mountains higher than the sky² and have made the most
> hackedly-hacky hack that probably I've ever done:
> 
> ffmpeg -i INPUT_FILE -frames 1 -vcodec copy -ss 10 -v quiet -y
> TEMPOARY_VIDEO.mkv
> ffmpeg -i TEMPOARY_VIDEO.mkv -v quiet -frames 1 -y OUTPUT.png
> 
> Yes -- two passes. The problem is that ffmpeg seems to always want to seek
> slowly or something -- but can seek fast if you force it not to decode any
> frames. Hence you need to do the seeking *within* the video. Or something.
> I don't really know why it works. This takes about 1.1 seconds, whereas:
> 
> ffmpeg -itsoffset 10 -i INPUT_FILE -vframes 1 -y OUTPUT.png
> 
> takes around 10 to 11 seconds. So it's a 10x speed up (that's more like the
> peak speed-up, to be fair). I have no idea how robust this is, but it seems
> to work on the two files I've tried.
> 
> ¹ Never happened
> ² Also never happened



reply via email to

[Prev in Thread] Current Thread [Next in Thread]