From 4392be9f01c896982febc60866d2210b6d1760b5 Mon Sep 17 00:00:00 2001 From: Will Storey Date: Thu, 11 Jan 2018 21:44:19 -0800 Subject: [PATCH] Make remux_example take output file and number of frames from CLI --- cmd/remux_example/remux_example.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cmd/remux_example/remux_example.c b/cmd/remux_example/remux_example.c index b6c4779..e87ac77 100644 --- a/cmd/remux_example/remux_example.c +++ b/cmd/remux_example/remux_example.c @@ -1,6 +1,4 @@ -// // This program remuxes from a given RTSP input to an mp4 container. -// #include #include @@ -8,17 +6,21 @@ int main(const int argc, const char * const * const argv) { - if (argc != 2) { - printf("Usage: %s \n", argv[0]); + if (argc != 4) { + printf("Usage: %s \n", + argv[0]); return 1; } + char const * const output_filename = argv[2]; + long long const max_frames = atoll(argv[3]); vs_setup(); const char * const input_format = "rtsp"; const char * const input_url = argv[1]; const char * const output_format = "mp4"; - const char * const output_url = "file:/tmp/out.mp4"; + char output_url[4096] = {0}; + sprintf(output_url, "file:%s", output_filename); const bool verbose = true; struct VSInput * const input = vs_open_input(input_format, input_url, @@ -36,8 +38,7 @@ int main(const int argc, const char * const * const argv) return 1; } - const int max_frames = 100; - int i = 0; + long long i = 0; while (1) { AVPacket pkt;