Comments

jetdv wrote on 7/22/2008, 8:07 AM
I suspect Excalibur or Ultimate S will probably already do what you're wanting to do. Or you could download a free snapshot script and modify it for your purposes.
PK77 wrote on 7/24/2008, 3:51 AM
can you help me modify this script to name snaphot on actual region at cursor position?

im not able do this :(


/*******************************************
* This script will save a snapshot from the timeline
*
* Written By: Edward Troxel - partially modified from the script by Joe Satcher
* www.jetdv.com
*******************************************/

import System;
import System.IO;
import System.Windows.Forms;
import Sony.Vegas;

// Where should the file be saved?
var destdir = "C:\\";

// What is the file name?
var destname = "MyPic";


// Save the current settings
var origPreviewRenderQuality = Vegas.Project.Preview.RenderQuality;
var origPreviewFillSize = Vegas.Project.Preview.FullSize;
var origFieldOrder = Vegas.Project.Video.FieldOrder;
var origProjectDeinterlaceMethod = Vegas.Project.Video.DeinterlaceMethod;
var currentTime = Vegas.Cursor;


try {
var imageFileName = destdir + destname + ".png";


// Set for the best quality.
Vegas.Project.Preview.RenderQuality = VideoRenderQuality.Best;
Vegas.Project.Preview.FullSize = true;
Vegas.Project.Video.FieldOrder = VideoFieldOrder.ProgressiveScan;
Vegas.Project.Video.DeinterlaceMethod = VideoDeinterlaceMethod.InterpolateFields;

// Show the script's dialog box.
var dialog = new SaveFileDialog();
dialog.Filter = "PNG File (*.png)|*.png|JPEG File (*.jpg)|*.jpg";
dialog.CheckPathExists = true;
dialog.AddExtension = true;
if (Directory.Exists(destdir)) {
dialog.InitialDirectory = destdir;
}
dialog.DefaultExt = Path.GetExtension(imageFileName);
dialog.FileName = Path.GetFileNameWithoutExtension(imageFileName);

// if the OK button was pressed...
if (dialog.ShowDialog() == DialogResult.OK) {
// Get the basis for output image file names
imageFileName = Path.GetFullPath(dialog.FileName);

// Get the output image file name extension
var imageFileNameExt = Path.GetExtension(imageFileName);
var imageFormat = ImageFileFormat.PNG;
if (0 == String.Compare(imageFileNameExt, ".jpg", true)) {
imageFormat = ImageFileFormat.JPEG;
}

// save a snapshot.
if (Vegas.SaveSnapshot(imageFileName, imageFormat, Vegas.Cursor) == RenderStatus.Complete) {
Vegas.UpdateUI();
}
}
} catch (e) {
MessageBox.Show(e);
}

// restore the project and preview settings
Vegas.Project.Preview.RenderQuality = origPreviewRenderQuality;
Vegas.Project.Preview.FullSize = origPreviewFillSize;
Vegas.Project.Video.FieldOrder = origFieldOrder;
Vegas.Project.Video.DeinterlaceMethod = origProjectDeinterlaceMethod;
Rosebud wrote on 7/25/2008, 3:07 PM
Try this cs script:


// Snapshot at markers
// by Gilles Pialat
// 07/25/2008

using System;
using System.IO;
using System.Text;
using System.Drawing;
using System.Reflection;
using System.Diagnostics;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Sony.Vegas;

public class EntryPoint
{
Vegas myVegas;

public void FromVegas(Vegas vegas)
{
try
{
myVegas = vegas;
string markerName;
string path;
char[] invalidChar = Path.GetInvalidFileNameChars();

FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.Description = "Please, choose a directory.";

if (String.IsNullOrEmpty(myVegas.Project.FilePath))
fbd.SelectedPath = @"c:\";
else
fbd.SelectedPath = Path.GetDirectoryName(myVegas.Project.FilePath);

if (fbd.ShowDialog().ToString() == "OK")
{
foreach (Marker marker in myVegas.Project.Markers)
{
markerName = marker.Position.ToString() + " _ ";
if (String.IsNullOrEmpty( marker.Label))
markerName = markerName + "Marker " + (marker.Index + 1).ToString();
else
markerName = markerName + marker.Label;

markerName = markerName + ".jpg";

foreach (char chr in invalidChar)
{
markerName = markerName.Replace( chr.ToString(), "-");
}

path = Path.Combine(fbd.SelectedPath, markerName);

if (myVegas.SaveSnapshot(path, ImageFileFormat.JPEG, marker.Position) == RenderStatus.Complete)
myVegas.UpdateUI();
}
}
else
MessageBox.Show("Script canceled");
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}

}
}
jetdv wrote on 7/26/2008, 8:19 AM
Rosebud, one thing I would add would be changing the preview mode to "Best (Full)" automatically in the script. You might also want to change the interlacing mode to Progressive automatically as well. At the end of the script, it should - obviously - reset them back to where the user originally had them set.
Rosebud wrote on 7/26/2008, 3:14 PM
Ok, new version with Edward suggestion.
(personally, I prefer to set those options manually).


// Snapshot at markers
// by Gilles Pialat
// 07/25/2008

using System;
using System.IO;
using System.Text;
using System.Drawing;
using System.Reflection;
using System.Diagnostics;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Sony.Vegas;

public class EntryPoint
{
Vegas myVegas;

public void FromVegas(Vegas vegas)
{
try
{
myVegas = vegas;
string markerName;
string path;
char[] invalidChar = Path.GetInvalidFileNameChars();

FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.Description = "Please, choose a directory.";

if (String.IsNullOrEmpty(myVegas.Project.FilePath))
fbd.SelectedPath = @"c:\";
else
fbd.SelectedPath = Path.GetDirectoryName(myVegas.Project.FilePath);

if (fbd.ShowDialog().ToString() == "OK")
{
VideoRenderQuality vidRenderQuality = myVegas.Project.Preview.RenderQuality;
bool vidFullSize = myVegas.Project.Preview.FullSize;
VideoFieldOrder vidFieldOrder = myVegas.Project.Preview.FieldOrder;
VideoDeinterlaceMethod vidDeinterlaceMethod = myVegas.Project.Video.DeinterlaceMethod;
Timecode cursorPos = myVegas.Cursor;

myVegas.Project.Preview.RenderQuality = VideoRenderQuality.Best;
myVegas.Project.Preview.FullSize = true;
myVegas.Project.Video.FieldOrder = VideoFieldOrder.ProgressiveScan;
myVegas.Project.Video.DeinterlaceMethod = VideoDeinterlaceMethod.InterpolateFields;

foreach (Marker marker in myVegas.Project.Markers)
{
markerName = marker.Position.ToString() + " _ ";
if (String.IsNullOrEmpty( marker.Label))
markerName = markerName + "Marker " + (marker.Index + 1).ToString();
else
markerName = markerName + marker.Label;

markerName = markerName + ".jpg";

foreach (char chr in invalidChar)
{
markerName = markerName.Replace( chr.ToString(), "-");
}

path = Path.Combine(fbd.SelectedPath, markerName);

if (myVegas.SaveSnapshot(path, ImageFileFormat.JPEG, marker.Position) == RenderStatus.Complete)
myVegas.UpdateUI();
}
myVegas.Project.Preview.RenderQuality = vidRenderQuality;
myVegas.Project.Preview.FullSize = vidFullSize;
myVegas.Project.Video.FieldOrder = vidFieldOrder;
myVegas.Project.Video.DeinterlaceMethod = vidDeinterlaceMethod;
myVegas.Cursor = cursorPos;
}
else
MessageBox.Show("Script canceled");
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
}
}
PK77 wrote on 7/28/2008, 12:57 AM
thank you very much , but i have little problem
i have few regions (named) and each include one marker.
need make snapshot at marker(now work pretty nice) and name it after region .

think is possible?
Rosebud wrote on 7/28/2008, 1:13 AM
I’m not sure to understand what your are looking for.
Why don’t you give the same label to your markers and your regions ?
PK77 wrote on 7/28/2008, 1:42 AM
yes i can give same label at region ,
just ask if possible by itself coz i do it very often

anyway thanks you for very usefull help
Rosebud wrote on 7/28/2008, 7:01 AM
try this one (your markers must to be in a region) :


// Snapshot at markers (Special version for PK77)
// by Gilles Pialat
// 07/28/2008

using System;
using System.IO;
using System.Text;
using System.Drawing;
using System.Reflection;
using System.Diagnostics;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Sony.Vegas;

public class EntryPoint
{
Vegas myVegas;

public void FromVegas(Vegas vegas)
{
try
{
myVegas = vegas;
string markerName;
string path;
char[] invalidChar = Path.GetInvalidFileNameChars();

FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.Description = "Please, choose a directory.";

if (String.IsNullOrEmpty(myVegas.Project.FilePath))
fbd.SelectedPath = @"c:\";
else
fbd.SelectedPath = Path.GetDirectoryName(myVegas.Project.FilePath);

if (fbd.ShowDialog().ToString() == "OK")
{
VideoRenderQuality vidRenderQuality = myVegas.Project.Preview.RenderQuality;
bool vidFullSize = myVegas.Project.Preview.FullSize;
VideoFieldOrder vidFieldOrder = myVegas.Project.Preview.FieldOrder;
VideoDeinterlaceMethod vidDeinterlaceMethod = myVegas.Project.Video.DeinterlaceMethod;
Timecode cursorPos = myVegas.Cursor;

myVegas.Project.Preview.RenderQuality = VideoRenderQuality.Best;
myVegas.Project.Preview.FullSize = true;
myVegas.Project.Video.FieldOrder = VideoFieldOrder.ProgressiveScan;
myVegas.Project.Video.DeinterlaceMethod = VideoDeinterlaceMethod.InterpolateFields;

foreach (Sony.Vegas.Region region in myVegas.Project.Regions)
{
foreach (Marker marker in myVegas.Project.Markers)
{
if ((marker.Position >= region.Position) && (marker.Position <= region.End))
{
markerName = marker.Position.ToString() + " _ ";
if (String.IsNullOrEmpty(region.Label))
markerName = markerName + "Marker " + (marker.Index + 1).ToString();
else
markerName = markerName + region.Label;

markerName = markerName + ".jpg";

foreach (char chr in invalidChar)
{
markerName = markerName.Replace(chr.ToString(), "-");
}

path = Path.Combine(fbd.SelectedPath, markerName);

if (myVegas.SaveSnapshot(path, ImageFileFormat.JPEG, marker.Position) == RenderStatus.Complete)
myVegas.UpdateUI();
}
}
}
myVegas.Project.Preview.RenderQuality = vidRenderQuality;
myVegas.Project.Preview.FullSize = vidFullSize;
myVegas.Project.Video.FieldOrder = vidFieldOrder;
myVegas.Project.Video.DeinterlaceMethod = vidDeinterlaceMethod;
myVegas.Cursor = cursorPos;
}
else
MessageBox.Show("Script canceled");
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}

}
}
PK77 wrote on 7/28/2008, 8:18 AM
absolutely excellent !!
you save from lots boring works

thanks you very much