PDA

View Full Version : Wanted: command line tool to export frame(s)


AsTimeGoesBy
16th December 2004, 17:08
Hello!
I'm looking for a command line tool for Win32 or Linux to export
one or multiple (key)frames out of a DivX or Xvid video file.

Thanks for any inputs.


PS: if somebody knows a possibility to do this by ImageMagick
or similar tools, please let me know too.

HighInBC
17th September 2005, 20:18
I also need this. Unfortunatly ImageMagick only works on UnCompressed avi's... sigh.

I need this for a perl script that needs to grab frames.


I made a cheap hack that uses VirtualDub, here is the subroutine:


sub grab_image
{
my $clip = shift; #|Import parameters
my $frame = shift; #|
my $template = # This is a template for a VirtualDub script
'
VirtualDub.Open("<FILE>","",0);
VirtualDub.audio.SetSource(1);
VirtualDub.subset.Clear();
VirtualDub.subset.AddRange(<FRAME>,1);
VirtualDub.SaveImageSequence("Frame-<FRAME>-", ".bmp", 0, 0);
VirtualDub.Close();
';
$template =~ s|<FILE>|$clip|; # Replace <FILE> with clipname
$template =~ s|<FRAME>|$frame|g; # Replace <FRAME> with frame number
open(FILE,'>temp.vcf'); # Open new file
print FILE ($template); # Write script
close(FILE); # Close file
system('C:/DVD Tools/VirtualDub-1.5.9/VirtualDub.exe','/stemp.vcf','/x');# Run the script with VirtualDub
unlink('temp.vcf'); # Delete temporary script
return "Frame-$frame-0.bmp"; # Return filename of frame image.
}


Of course you have to change that path in your system command to match your virtual dub path.

I don't know if this is any help, as it is not strictly command line. You must make a script based on the template, then run the command line. Good luck, hope this helps.

jonny
18th September 2005, 12:51
ffmpeg -y -i video.avi -f singlejpeg -ss 00:00:00.000 -vframes 1 -an test.jpg

http://ffmpeg.sourceforge.net/index.php

you can grab the latest cvs and built ffmpeg in linux or winzoz/cygwin

Matthew
18th September 2005, 13:59
I use YAAI to generate a text file with stats, and then I grab the frame count out of that. It's cli and silent :)

edit: mmm...this is an old post.

jonny
18th September 2005, 14:16
lol 16 dec 2004 :D
... maybe he still need this ... :D