View Full Version : A program for generate thumbnail from a lot of videos?
vvcepheus7
24th February 2012, 14:44
hello, someone knows some program to extract one frame of one video in jpg format? I want do this of a lot of 1000 videos. I want to choose the exact moment in which it is to capture the frame.
best regards
Ghitulescu
24th February 2012, 14:51
All media players I know have this function (not all in JPEG, generally in BMP/PNG/lossless).
vvcepheus7
24th February 2012, 14:53
I know this but I need do it automatically, I have 1000 videos. I can't capture one to one, is too much work!
Ghitulescu
24th February 2012, 15:22
And do you have telepathic powers to instruct that software, see, take a snapshot form movie 1 at 12:34:43.234, from movie 2 at 05:09:12.548, ..., from movie 1000 at 121:09:05.120, without moving a finger?
vvcepheus7
24th February 2012, 15:37
haha, nono, I want fix the same snapshot for all videos!! :) For exemple fix second 10 (or other) for capture of ALL videos.
I found Video Thumbnails Maker 4.0.0.1 but this soft not have this function!
LoRd_MuldeR
24th February 2012, 16:26
FFmpeg is your friend:
http://ffmpeg.org/faq.html#How-do-I-encode-movie-to-single-pictures_003f
If you need to do this with a huge number of files, write a simple batch/shell script.
vvcepheus7
24th February 2012, 16:43
FFmpeg is your friend:
http://ffmpeg.org/faq.html#How-do-I-encode-movie-to-single-pictures_003f
If you need to do this with a huge number of files, write a simple batch/shell script.
thanks for your reply!
Sorry but my knowledge about scripping is limited! Can you say me what is the code for do it please?
All of my videos are in format mp4/h.264/aac. So, all videos have mp4 extension. All videos are in the same directory. If I want capture the second 10 of each video what is the code for do it this??
Thanks a lot!!
:helpful:
PS I use win7 x64. where is the link to installer? In http://ffmpeg.org only see source code! I don't know built binary for windows.
LoRd_MuldeR
24th February 2012, 17:26
You can download FFmpeg binaries here, for example:
http://ffmpeg.zeranoe.com/builds/
A simple batch script could look like this:
@echo off
set "ffmpeg_bin=C:\Program Files\FFmpeg\ffmpeg.exe"
set "out_path=C:\Foo\Bar\Output"
cd /D "C:\Foo\Bar\Videos"
for %%f in (*.mp4) do (
%ffmpeg_bin% -i "%%~f" "%out_path%\%%~nf.%%d.jpg"
)
As I guess that you don't want pictures for the complete video, you may also want to pass something like this to FFmpeg:
-ss 00:00:10 -t 00:00:05
vvcepheus7
24th February 2012, 17:42
Exellent!!! works very fine! thank you LoRd_MuldeR!!
One more thing... how you can fix a instant time for the capture?? If I want capture at second 50 of each video, ¿how would be the code?
thanks a lot!!
LoRd_MuldeR
24th February 2012, 17:44
Adjust "-ss" accordingly to the time index where you want to start capturing.
I'm not quite sure you can get FFmpeg to capture exactly one picture, but you can try to set "-t" one second.
vvcepheus7
26th February 2012, 14:25
Thanks LoRd_MuldeR, but you're sure that the code is correct?
If a use this code I get a lot of captures, not only one capture:
@echo off
set "ffmpeg_bin=C:\ffmpeg\ffmpeg-git-b6ff81d-win64-static\bin\ffmpeg.exe"
set "out_path=C:\Banco de pruebas\Fotos"
cd /D "C:\Banco de pruebas\Videos"
for %%f in (*.mp4) do (
%ffmpeg_bin% -ss 00:00:10 -i "%%~f" "%out_path%\%%~nf.%%d.jpg"
)
You can revise it, please?
I've tried with this code and I think that work ok but I get any errors during execution:
This is the code:
@echo off
set "ffmpeg_bin=C:\ffmpeg\ffmpeg-git-b6ff81d-win64-static\bin\ffmpeg.exe"
set "out_path=C:\Banco de pruebas\Fotos"
cd /D "C:\Banco de pruebas\Videos"
for %%f in (*.mp4) do (
%ffmpeg_bin% -ss 00:00:15 -i "%%~f" "%out_path%\%%~f%.jpg"
)
This is the error:
Press [q] to stop, [?] for help
DTS -199750, next:-6658333 st:0 invalid droping
DTS -198749, next:-6624966 st:0 invalid droping
DTS -197748, next:-6591599 st:0 invalid droping
DTS -196747, next:-6558232 st:0 invalid droping
DTS -195746, next:-6524865 st:0 invalid droping
frame= 0 fps= 0 q=0.0 size= 0kB time=00:00:00.00 bitrate= 0.0kbits/s
frame= 0 fps= 0 q=0.0 size= 0kB time=00:00:00.00 bitrate= 0.0kbits/s
frame= 0 fps= 0 q=0.0 Lsize= 0kB time=00:00:00.00 bitrate= 0.0kbits/
s dup=0 drop=196
video:0kB audio:0kB global headers:0kB muxing overhead -1.#IND00%
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters i
f used)
despite that error the code extracts correctly the image of instant 15s. You think that all is ok? you can revise this code also?
Thanks master!
LoRd_MuldeR
26th February 2012, 14:30
Well, FFmpeg will convert the video to a sequence of images with that command-line.
You can set the start position with "-ss" option. And you can set the duration with "-t" option.
With "-t 0:00:01" you can instruct FFmpeg to dump only one second.
I don't know if there is a way to get exactly one frame...
[EDIT]
Try with "-frames 1" ;)
vvcepheus7
26th February 2012, 14:35
I don't know if there is a way to get exactly one frame...
If I use the second code I get exactly one frame!
But I get one error during execution. I think that this error is not important because the picture is ok. So finish, run very well :D
Thank you!
vvcepheus7
26th February 2012, 14:36
I see that you edited the post. Now I try this! :)
thanks!!
vvcepheus7
26th February 2012, 14:43
@echo off
set "ffmpeg_bin=C:\ffmpeg\ffmpeg-git-b6ff81d-win64-static\bin\ffmpeg.exe"
set "out_path=C:\Banco de pruebas\Fotos"
cd /D "C:\Banco de pruebas\Videos"
for %%f in (*.mp4) do (
%ffmpeg_bin% -ss 00:00:10 -frames 1 -i "%%~f" "%out_path%\%%~nf.%%d.jpg"
)
this don't work, continue make a lot of captures. But is not important, with your first code (before you edit) the task run perfectly!:
@echo off
set "ffmpeg_bin=C:\ffmpeg\ffmpeg-git-b6ff81d-win64-static\bin\ffmpeg.exe"
set "out_path=C:\Banco de pruebas\Fotos"
cd /D "C:\Banco de pruebas\Videos"
for %%f in (*.mp4) do (
%ffmpeg_bin% -ss 00:00:15 -i "%%~f" "%out_path%\%%~f%.jpg"
)
But I don't know what is the difference between the 2 codes! :p
I use this code for the moment
Thanks!
LoRd_MuldeR
27th February 2012, 00:46
This works very well for me with latest FFmpeg:
@echo off
set "ffmpeg_bin=C:\Program Files\FFmpeg\ffmpeg.exe"
set "out_path=C:\Foo\Bar\Output"
cd /D "C:\Foo\Bar\Videos"
for %%f in (*.avi) do (
echo %%~f
%ffmpeg_bin% -i "%%~f" -ss 00:00:15 -frames 1 "%out_path%\%%~nf.%%d.jpg"
)
smok3
27th February 2012, 09:06
or similar:
ffmpeg -ss 10 -i file.in out.png -vframes 1 -an -f image2 -loglevel quiet
relevant part of my sh, that I use on OSX (configured for wdtv thumbs):
for files in "$@" ;do
echo $files
dur=`$mediainfo "--Inform=Video;%Duration%" "$files"`
half=`echo "$dur/2000" | bc`
$ffmpeg -ss $half -i "$files" "${files%.*}.png" -vframes 1 -an -f image2 -loglevel quiet
# sips is bundled
sips -s format jpeg --resampleHeight 180 --cropToHeightWidth 180 120 "${files%.*}.png" --out "${files%.*}.jpg"
rm "${files%.*}.png"
on win/linux you could use something like convert (from ImageMagick) instead of sips.
vvcepheus7
28th February 2012, 13:50
many thanks for the info!! :)
alysonshaw
12th March 2012, 03:55
I have to agree all programs can do it. So choose what fits you bets. :)
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.