How to create a thumbnail from a video - final solution (?)

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
Rozis
Blank Cone
Blank Cone
Posts: 14
Joined: 07 Sep 2006 23:21
Contact:

How to create a thumbnail from a video - final solution (?)

Postby Rozis » 12 Sep 2006 01:22

For all those people wanting a thumbnail from a video, use the following command (Windows):

Code: Select all

vlc -V image --start-time 0 --stop-time 1 --image-out-format jpg --image-out-ratio 24 --image-out-prefix snap test.mpg vlc:quit
What it does:

When Vlc runs it 'plays' the video for one second without actually showing the video on screen, and then quits, leaving us with a file named 'snap000000.jpg', containing an image of the first frame (?) of the video.

How its works:

First select the image output with: -V image.

Next set the interval (in seconds) you want an image from with: --start-time 0 --stop-time 1
In my example the first second of the video. In that case you could omit the parameter --start-time. If you want an image from the 5th second fill in: --start-time 5 --stop-time 6

The image format will be .jpg because i provided: --image-out-format jpg. You could specify --image-out-format png to get a .png-image instead.

--image-out-ratio 24 specifies we want one image out of 24. In my case the video contains 24 images per second so this is the right value. If your video has more images per seconds you should increase this value to prevend you get more images as one. If the number is too high (for example 500) it still produces only one image, so the actual value is not so important as long as it is higher then the images per second.

--image-out-prefix snap specifies the filename must start with 'snap'. I tried to fill in a path but that doesn't work: the prefix specifies the basename of the file only.
You could specify --no-image-out-replace. In that case Vlc produces the file 'snap.jpg'.

test.mpg specifies the video to play and finally vlc:quit forces vlc to quit when ready.

I hope this explaination helps all people wanting thumbnails of a video.

One question remains: If you want to make thumbnails of many files each file takes one second to take an image from. Is there any commandline-option to 'play' videos with enhanched velocity? And is there a possibility to run Vlc completely in the background (now it leaves me with the player)?

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Postby Jean-Baptiste Kempf » 12 Sep 2006 09:26

Could you put this on the wiki please ?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

Rozis
Blank Cone
Blank Cone
Posts: 14
Joined: 07 Sep 2006 23:21
Contact:

Postby Rozis » 12 Sep 2006 21:06

Of course it's your party but why put it on the wiki? and where? Couldn't find a logical place there. Is the FAQ or the documentation not a more logical place?

and what about my last 2 questions?

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Postby Jean-Baptiste Kempf » 13 Sep 2006 01:13

I'll do it in Wiki, but a Howto would be great.
You can switch from a file to another for multiple files.
you can use the -d flags to run vlc in the background, I think.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

Rozis
Blank Cone
Blank Cone
Posts: 14
Joined: 07 Sep 2006 23:21
Contact:

Postby Rozis » 13 Sep 2006 01:29

I searched the wiki but found no logical place. Could you direct me to the place where to put it? I'll put it there then. And thanks for the clues, it can make the article even more meaningfull.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Postby Jean-Baptiste Kempf » 13 Sep 2006 07:25

http://wiki.videolan.org/index.php/How_to
From there, put a link to
http://wiki.videolan.org/index.php/What_can_vlc_do, and add this howto in this page. :lol:
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

spline
New Cone
New Cone
Posts: 5
Joined: 24 Sep 2006 22:52

Postby spline » 24 Sep 2006 23:00

Hi there,

first thanks for this hint.
I tried to make some snapshot from some vidieos using perl.
The command i used to call VLC is:
`C:\Programme\VideoLan\VLC\VLC.exe -V image --start-time 10 --stop-time 11 --image-out-format jpg --image-out-ratio 50 -image-out-prefix "1-10-" "here is the video name.avi" vlc:quit`

start-time, stop-time and image-out-prefix are variables set by the Perl script. The change for every call.
Problem is, that for some reason, VLC does not make a snapshot.
On some videos it comes up with an error message.
Am i doing something wrong??

Regards

spline

rh
Cone that earned his stripes
Cone that earned his stripes
Posts: 158
Joined: 21 Sep 2006 13:11
VLC version: 2.0.2
Operating System: Lin / Win / Andr
Location: Germany

Postby rh » 26 Sep 2006 16:58

Hi,
i think jpg do not work. I use this string to capture screenshots from my desktop:

vlc -vvv -I dummy -V image --start-time 1 --stop-time 2 --image-out-format png --image-out-ratio 200 --image-out-prefix snapshot screen://

This generate two pictures per minute, depended on changing your desktop.
Greetings, rh

rh
Cone that earned his stripes
Cone that earned his stripes
Posts: 158
Joined: 21 Sep 2006 13:11
VLC version: 2.0.2
Operating System: Lin / Win / Andr
Location: Germany

Postby rh » 27 Sep 2006 09:50

Hi,
this is not the solution for this problem.

If i take my command-line to work with a avi-file (or also with mpg-file) many errors occured. So for instance "invalid start-time ignored", "invalid stop-time ignored" and so one. Based on this i think this feature is not passible.

If you find a solution, please post it.
Greetings, rh

spline
New Cone
New Cone
Posts: 5
Joined: 24 Sep 2006 22:52

Postby spline » 29 Sep 2006 07:16

Hi,

thnaks for the answers.
I tried it with some more videos and teh result is dissapointing. Some work perfect, some work with some errors (which stops me doing this as a batch for lot of files, because i allways have to click the "Close" buton on VLC) and for some it works not at all (no snapshot is taken).

Maybe some developer can have a look on this. I've searched the forum (not only VLC one, but a lot of others) and it seems, that this feature (snapshots via batch) is reqested often. And as far as i know, there are no other program that is able to do this via command line for nearly every codec.

Regards


spline

spline
New Cone
New Cone
Posts: 5
Joined: 24 Sep 2006 22:52

Postby spline » 09 Oct 2006 14:39

Hi all,

i tried to make snapshots / screenshots via the command line for some more videos.
It doesn't work reliable ;-(
I will check what all the videos for which making a snapshot is failing have in common. Maybe it's dependant on a specific codec.
Does it make sense to open a bug in the tracking system?


Regards

spline

Rozis
Blank Cone
Blank Cone
Posts: 14
Joined: 07 Sep 2006 23:21
Contact:

Postby Rozis » 11 Oct 2006 23:29

Hi Spline,

First: The command i provided in the topic works fine for me. But i only tried it on movies coming from my camara, so all movies have the same fromat...

I have the following suggestions:
- starttime: if the movie is actually shorter then the given starttime i could image it gives an error. Maybe try 0 first...
- Your comment suggests the whole thing doesn't work: my question, if you only use starttime stoptime is the same true? What is not working: displaying a bit of the movie or making the snapshot?
- As far as i understand the stuff about codexes i could image there could be somethin' wrong there, so one image is working fine but the other doesn't...

I'm sorry i don't have a final solution (that's why it contained a '?') but i'm interrested in your progress...

Rozis

darthShana
New Cone
New Cone
Posts: 2
Joined: 09 Apr 2007 07:44

getting snapshot from video

Postby darthShana » 22 May 2007 21:50

Hi im tring to get snapshot from my webcam through the commandline
vlc -V image --start-time 0 --stop-time 1 --image-out-format jpg --image-out-ratio 24 --image-out-prefix snap test.mpg vlc:quit
that works and gets a snapshot of the video

vlc -V image --start-time 0 --stop-time 1 --image-out-format jpg --image-out-ratio 24 --image-out-prefix snap screen://
that works and gets you a picture of your desktop

vlc -V image --start-time 0 --stop-time 1 --image-out-format jpg --image-out-ratio 24 --image-out-prefix snap dshow:// vdev="Logitech QuickCams / Go" vlc:quit
this does'nt seem to work i can see my web cam being activated but no picture saved. paerhaps my image params are wrong ?
darthShana

cctvcam
Blank Cone
Blank Cone
Posts: 29
Joined: 20 Jul 2010 15:29

Re: How to create a thumbnail from a video - final solution

Postby cctvcam » 09 Mar 2011 17:19

Does anyone know what the updated cmdline is for vlc 1.1.3 as the above don't seem to work. I think the -V is obsolete?

ComCBoVudLaBa
New Cone
New Cone
Posts: 1
Joined: 08 May 2012 23:25

Re: How to create a thumbnail from a video - final solution

Postby ComCBoVudLaBa » 09 May 2012 01:26

Hi,

Posting late to this page, but this information is not easy to find around, especially ready-to-use, working command lines.
I spent some time fiddling with the many VLC arguments before finding the right combination.
I provide some basic explanations for those not too familiar with the niceties of Windows command line use.



The below command is certified to work with VLC version 2.x under Windows 7 64 bits - On any 32 bits Windows, simply adjust the VLC.exe path (usually by removing '( x86)'

Make sure to first update the <variables> to suit your context and to double quote any PATH or file name which includes space characters :

"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --rate=1 --video-filter=scene --start-time=2 --stop-time=6 --scene-format=png --scene-ratio=24 --snapshot-sequential --scene-path=<OUTPUT_DIR_PATH> --scene-prefix=<PREFIX_> <DIRECTORY_PATH>\<VideoFileName.ext> vlc://quit


This will create 5 sequentially numbered .PNG snapshots from the first five seconds or so of the targeted video (if at 24 images/sec) in the current directory. The files created will have the target video file name as prefix if argument is provided as such.

Change the start-time, stop-time and scene-ratio as needed to create more or fewer images. '--scene-ratio' is the number of images between each snapshot.
'start-time' and 'stop-time' tell how many images you want to create. These will be from image number start-time x scene-ratio to stop-time x scene-ratio.
A snapshot of the first image of the video is always created.

<DIRECTORY_PATH>\ is optional if your source video is in the current directory.
If --scene-path=<OUTPUT_DIR_PATH> is not provided, the snapshots are created in the current user 'My Pictures' folder.



Now if the current directory contains the video you want to process, and you want the snapshots created there too, you can make it all simple with something like the below command :


"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --rate=1 --video-filter=scene --start-time=2 --stop-time=6 --scene-format=png --scene-ratio=24 --snapshot-sequential --scene-path="%CD%" --scene-prefix="VideoFileName-" "VideoFileName.ext" vlc://quit



And to make it all even simpler again, if your current directory contains a bunch of videos from which you want to extract snapshots, just use the command below (this will work just as fine if there is just one video) :

Again, make sure to adjust the file filter and other arguments according to your needs. At least, specify the correct extension for your videos if needed (replace the .flv provided here).
This will work as provided if copy/pasted into a command prompt window, but you will have to double any percent '%' sign in the line if you want to use the command in a batch file.

This will create 5 snapshots from the beginning of each video found in the current directory, creating files with the same name as the video, numbered as _00001 etc.
This works OK under Windows, including with directories and filenames which include space characters.


for %i in (*.flv) do if NOT exist "%~ni_*.png" start /WAIT "" "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --rate=1 --video-filter=scene --start-time=2 --stop-time=6 --scene-format=png --scene-ratio=24 --snapshot-sequential --scene-path="%CD%" --scene-prefix="%~ni_" "%CD%\%i" vlc://quit


The start /WAIT "" part is necessary so only ONE video will be processed at a time. The empty pair of double quotes after /WAIT is mandatory : it is a required argument for the shell 'start' command.
The if NOT exist "%~ni_*.png" part allows the line to NOT recreate snapshots if any already exist. Remove it if you want to recreate them every time.



Hope this helps some.


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: Google [Bot] and 17 guests