Skip to content

Commit

Permalink
Make remux_example take output file and number of frames from CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
nickorzha committed Jan 12, 2018
1 parent 53de681 commit 35f609c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions cmd/remux_example/remux_example.c
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
//
// This program remuxes from a given RTSP input to an mp4 container.
//

#include <stdbool.h>
#include <stdio.h>
#include <videostreamer.h>

int main(const int argc, const char * const * const argv)
{
if (argc != 2) {
printf("Usage: %s <RTSP URL>\n", argv[0]);
if (argc != 4) {
printf("Usage: %s <input RTSP URL> <output mp4 file> <max frames>\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,
Expand All @@ -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;
Expand Down

0 comments on commit 35f609c

Please sign in to comment.