Capture video with automatic file name
Moderator: InsideQC Admins
3 posts
• Page 1 of 1
Capture video with automatic file name
This is a quick little change that automatically generates a video filename, just like the way screenshot generates a filename. It works with JoeQuake and derivatives like Qrack, Fitzquake Mark V, and Super8. Any "capture_start" without an argument will get an automatic name.
The benefit? Bind a function key to capture_start and another one to capture_stop to quickly toggle video capture. Super cool when combined with Baker's demo rewind/fastforward/pause found in Mark V source.
The benefit? Bind a function key to capture_start and another one to capture_stop to quickly toggle video capture. Super cool when combined with Baker's demo rewind/fastforward/pause found in Mark V source.
- Code: Select all
void Movie_Start_f (void)
{
char name[MAX_OSPATH], path[256]; //qbism jqavi was MAX_FILELENGTH
//////////////////////CUT+PASTE START/////////////////////////////////////////
int i;
if (Cmd_Argc() != 2) //qbism - autogenerate file name if none is given.
{
Q_strcpy(name,"quake00.avi");
for (i=0 ; i<=99 ; i++)
{
name[5] = i/10 + '0';
name[6] = i%10 + '0';
sprintf (path, "%s/%s", com_gamedir, name);
if (Sys_FileTime(path) == -1)
break; // file doesn't exist
}
if (i==100)
{
Con_Printf ("Movie_Start_f: Too many AVI files in directory.\n");
return;
}
}
else //read the arg
{
Q_strncpyz (name, Cmd_Argv(1), sizeof(name));
COM_ForceExtension (name, ".avi");
}
//////////////////////CUT+PASTE END/////////////////////////////////////////
hack_ctr = capture_hack.value;
Q_snprintfz (path, sizeof(path), "%s/%s", com_gamedir, name);
if (!(moviefile = fopen(path, "wb")))
{
COM_CreatePath (path);
if (!(moviefile = fopen(path, "wb")))
{
Con_Printf ("ERROR: Couldn't open %s\n", name);
return;
}
}
movie_is_capturing = Capture_Open (path);
}
-
qbism - Posts: 1236
- Joined: Thu Nov 04, 2004 5:51 am
Re: Capture video with automatic file name
I recently went into trouble because many engines limit themselves to 100 screenshots. Would be great if you could add at least one zero to the filename.
The engine I use (not public sadly) let's the user specify the demo name from variables. By default it uses the bsp filename, player name and datetime (might be my settings actually, I dont remember if I ever changed them). game/mod name might be a nice addition too. Anything that helps not to be in the "nameless" quake001.avi, quake042.avi and quake123.avi hell.
The engine I use (not public sadly) let's the user specify the demo name from variables. By default it uses the bsp filename, player name and datetime (might be my settings actually, I dont remember if I ever changed them). game/mod name might be a nice addition too. Anything that helps not to be in the "nameless" quake001.avi, quake042.avi and quake123.avi hell.
Improve Quaddicted, send me a pull request: https://github.com/SpiritQuaddicted/Quaddicted-reviews
- Spirit
- Posts: 1031
- Joined: Sat Nov 20, 2004 9:00 pm
Re: Capture video with automatic file name
Should be fairly easy. And adding a character would still be DOS compatible. (If it would be possible to vid cap in DOS.)Spirit wrote:Would be great if you could add at least one zero to the filename.
Not near my comp, but something like
- Code: Select all
...
Q_strcpy(name,"quake000.avi");
for (i=0 ; i<=999 ; i++)
{
name[5] = i/100 + '0';
name[6] = i/10 + '0';
name[7] = i%10 + '0';
sprintf (path, "%s/%s", com_gamedir, name);
if (Sys_FileTime(path) == -1)
break; // file doesn't exist
}
if (i==1000)
...
-
qbism - Posts: 1236
- Joined: Thu Nov 04, 2004 5:51 am
3 posts
• Page 1 of 1
Return to Programming Tutorials
Who is online
Users browsing this forum: No registered users and 1 guest