Can now mux audio with video. Audio/Video saved in start path. Make sure to delete zmovie.cfg before recording with this change.
This commit is contained in:
@@ -1,17 +1,24 @@
|
|||||||
md_raw_file times 50 db "rawvideo.bin" @ Only for Raw Video
|
md_raw_file times 50 db "rawvideo.bin" @ Only for Raw Video
|
||||||
md_pcm_audio times 50 db "pcmaudio.wav" @ AVI dumping always dumps audio seperatly
|
md_pcm_audio times 50 db "audio.wav" @ AVI dumping always dumps audio seperatly
|
||||||
|
|
||||||
md_ntsc times 20 db "59649/995"
|
md_ntsc times 20 db "59649/995"
|
||||||
md_pal times 5 db "50/1"
|
md_pal times 5 db "50/1"
|
||||||
|
|
||||||
|
md_file times 50 db "video.avi"
|
||||||
md_prog times 50 db "mencoder"
|
md_prog times 50 db "mencoder"
|
||||||
md_raw times 100 db "-demuxer rawvideo -rawvideo format=0x42475218:w=256:h=224:size=172032"
|
md_raw times 100 db "-demuxer rawvideo -rawvideo format=0x42475218:w=256:h=224:size=172032"
|
||||||
md_other times 75 db "-aspect 4:3 -mc 0 -nosound"
|
md_other times 75 db "-aspect 4:3 -mc 0"
|
||||||
md_file times 50 db "video.avi"
|
md_no_sound times 25 db "-nosound"
|
||||||
|
md_sound times 50 db "-oac mp3lame -lameopts aq=0:preset=64"
|
||||||
|
md_x264 times 100 db "-ovc x264 -x264encopts qp_constant=0:frameref=15"
|
||||||
|
md_ffv1 times 100 db "-ovc lavc -lavcopts vcodec=ffv1:vstrict=-2:aspect=4/3"
|
||||||
|
|
||||||
@Valid variables to use in the next three lines are:
|
@Valid variables to use in the next two lines are:
|
||||||
@$md_prog, $md_raw, $md_other, $md_file, $md_video_rate
|
@$md_file, $md_prog, $md_raw, $md_other, $md_no_sound, $md_sound, $md_pcm_audio
|
||||||
|
@and $md_video_rate, $md_vcodec
|
||||||
@These variables are defined above.
|
@These variables are defined above.
|
||||||
@$md_video_rate is $md_ntsc or $md_pal depending on the game as needed
|
@$md_video_rate is $md_ntsc or $md_pal depending on the game as needed
|
||||||
md_uncompressed times 150 db "$md_prog $md_other $md_raw:fps=$md_video_rate -ovc copy -o $md_file -"
|
@$md_vcodec is $md_x264 or $md_ffv1 depending on the codec selected
|
||||||
md_x264 times 150 db "$md_prog $md_other $md_raw:fps=$md_video_rate -ovc x264 -x264encopts qp_constant=0:frameref=15 -o $md_file -"
|
|
||||||
md_ffv1 times 150 db "$md_prog $md_other $md_raw:fps=$md_video_rate -ovc lavc -lavcopts vcodec=ffv1:vstrict=-2:aspect=4/3 -o $md_file -"
|
md_command times 150 db "$md_prog $md_other $md_no_sound $md_raw:fps=$md_video_rate $md_vcodec -o $md_file -"
|
||||||
|
md_merge times 150 db "$md_prog $md_other $md_sound -audiofile $md_pcm_audio -ovc copy -o merged.avi $md_file"
|
||||||
@@ -562,6 +562,8 @@ void ccmdline()
|
|||||||
handle_params(argc, argv);
|
handle_params(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char ZStartPath[PATH_MAX];
|
||||||
|
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
extern HINSTANCE hInst;
|
extern HINSTANCE hInst;
|
||||||
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
|
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
|
||||||
@@ -572,6 +574,8 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine,
|
|||||||
hInst=hInstance;
|
hInst=hInstance;
|
||||||
ImportDirectX();
|
ImportDirectX();
|
||||||
|
|
||||||
|
getcwd(ZStartPath, PATH_MAX);
|
||||||
|
|
||||||
zstart();
|
zstart();
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
@@ -587,6 +591,8 @@ int main(int zargc, char *zargv[])
|
|||||||
handle_params(zargc, zargv);
|
handle_params(zargc, zargv);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
getcwd(ZStartPath, PATH_MAX);
|
||||||
|
|
||||||
zstart();
|
zstart();
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1876,6 +1876,8 @@ unsigned char AudioLogging;
|
|||||||
extern unsigned char MovieVideoMode;
|
extern unsigned char MovieVideoMode;
|
||||||
extern unsigned char MovieAudioMode;
|
extern unsigned char MovieAudioMode;
|
||||||
|
|
||||||
|
extern char ZStartPath[PATH_MAX];
|
||||||
|
|
||||||
#define PICK_HELP(var) if (!strncmp(*str, "$"#var, strlen(#var)+1)) { *str += strlen(#var)+1; return(var); }
|
#define PICK_HELP(var) if (!strncmp(*str, "$"#var, strlen(#var)+1)) { *str += strlen(#var)+1; return(var); }
|
||||||
|
|
||||||
static char *pick_var(char **str)
|
static char *pick_var(char **str)
|
||||||
@@ -1884,29 +1886,33 @@ static char *pick_var(char **str)
|
|||||||
PICK_HELP(md_raw);
|
PICK_HELP(md_raw);
|
||||||
PICK_HELP(md_other);
|
PICK_HELP(md_other);
|
||||||
PICK_HELP(md_file);
|
PICK_HELP(md_file);
|
||||||
|
PICK_HELP(md_sound);
|
||||||
|
PICK_HELP(md_no_sound);
|
||||||
|
PICK_HELP(md_pcm_audio);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!strncmp(*str, "$md_video_rate", strlen("$md_video_rate")))
|
if (!strncmp(*str, "$md_video_rate", strlen("$md_video_rate")))
|
||||||
{
|
{
|
||||||
*str += strlen("$md_video_rate");
|
*str += strlen("$md_video_rate");
|
||||||
return(romispal ? md_pal : md_ntsc);
|
return(romispal ? md_pal : md_ntsc);
|
||||||
}
|
}
|
||||||
|
if (!strncmp(*str, "$md_vcodec", strlen("$md_vcodec")))
|
||||||
|
{
|
||||||
|
*str += strlen("$md_vcodec");
|
||||||
|
return(MovieVideoMode == 2 ? md_ffv1 : md_x264);
|
||||||
|
}
|
||||||
*str += strlen(*str);
|
*str += strlen(*str);
|
||||||
fprintf(stderr, "Unknown Variable: %s", *str);
|
fprintf(stderr, "Unknown Variable: %s", *str);
|
||||||
return("");
|
return("");
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *open_movie_file()
|
static char *encode_command(char *p)
|
||||||
{
|
{
|
||||||
char command[450], *p, *var;
|
static char command[700];
|
||||||
|
char *var;
|
||||||
*command = 0;
|
*command = 0;
|
||||||
|
|
||||||
switch (MovieVideoMode)
|
|
||||||
{
|
|
||||||
case 2: p = md_uncompressed; break;
|
|
||||||
case 3: p = md_ffv1; break;
|
|
||||||
case 4: p = md_x264; break;
|
|
||||||
default: p = "$"; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (*p)
|
while (*p)
|
||||||
{
|
{
|
||||||
if ((var = strchr(p, '$')))
|
if ((var = strchr(p, '$')))
|
||||||
@@ -1923,7 +1929,8 @@ FILE *open_movie_file()
|
|||||||
}
|
}
|
||||||
|
|
||||||
puts(command);
|
puts(command);
|
||||||
return(popen(command, WRITE_BINARY));
|
|
||||||
|
return(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct
|
struct
|
||||||
@@ -1941,6 +1948,8 @@ struct
|
|||||||
|
|
||||||
static void raw_video_close()
|
static void raw_video_close()
|
||||||
{
|
{
|
||||||
|
bool audio_and_video = raw_vid.vp && raw_vid.ap;
|
||||||
|
|
||||||
if (raw_vid.vp)
|
if (raw_vid.vp)
|
||||||
{
|
{
|
||||||
switch (MovieVideoMode)
|
switch (MovieVideoMode)
|
||||||
@@ -1948,7 +1957,7 @@ static void raw_video_close()
|
|||||||
case 1:
|
case 1:
|
||||||
fclose(raw_vid.vp);
|
fclose(raw_vid.vp);
|
||||||
break;
|
break;
|
||||||
case 2: case 3: case 4:
|
case 2: case 3:
|
||||||
pclose(raw_vid.vp);
|
pclose(raw_vid.vp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1973,6 +1982,14 @@ static void raw_video_close()
|
|||||||
raw_vid.ap = 0;
|
raw_vid.ap = 0;
|
||||||
AudioLogging = 0;
|
AudioLogging = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (audio_and_video && (MovieAudioMode == 2))
|
||||||
|
{
|
||||||
|
chdir(ZStartPath);
|
||||||
|
system(encode_command(md_merge));
|
||||||
|
remove(md_file);
|
||||||
|
remove(md_pcm_audio);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool raw_video_open()
|
static bool raw_video_open()
|
||||||
@@ -1985,11 +2002,13 @@ static bool raw_video_open()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
chdir(ZStartPath);
|
||||||
raw_vid.vp = fopen(md_raw_file, "wb");
|
raw_vid.vp = fopen(md_raw_file, "wb");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: case 3: case 4:
|
case 2: case 3:
|
||||||
raw_vid.vp = open_movie_file();
|
chdir(ZStartPath);
|
||||||
|
raw_vid.vp = popen(encode_command(md_command), WRITE_BINARY);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user