-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This works for streaming mp4 from rtsp. But only to the first client as it is unable to recognize discrete frames correctly. It needs further work.
- Loading branch information
0 parents
commit a2b54be
Showing
7 changed files
with
1,758 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
CC=gcc | ||
|
||
# Reviewed warnings for gcc 6.2.1 | ||
CFLAGS = \ | ||
-std=c11 -g -ggdb -pedantic -pedantic-errors \ | ||
-Werror -Wall -Wextra \ | ||
-Wformat=2 \ | ||
-Wformat-signedness \ | ||
-Wnull-dereference \ | ||
-Winit-self \ | ||
-Wmissing-include-dirs \ | ||
-Wshift-overflow=2 \ | ||
-Wswitch-default \ | ||
-Wswitch-enum \ | ||
-Wunused-const-variable=2 \ | ||
-Wuninitialized \ | ||
-Wunknown-pragmas \ | ||
-Wstrict-overflow=5 \ | ||
-Wsuggest-attribute=pure \ | ||
-Wsuggest-attribute=const \ | ||
-Wsuggest-attribute=noreturn \ | ||
-Wsuggest-attribute=format \ | ||
-Warray-bounds=2 \ | ||
-Wduplicated-cond \ | ||
-Wfloat-equal \ | ||
-Wundef \ | ||
-Wshadow \ | ||
-Wbad-function-cast \ | ||
-Wcast-qual \ | ||
-Wcast-align \ | ||
-Wwrite-strings \ | ||
-Wconversion \ | ||
-Wjump-misses-init \ | ||
-Wlogical-op \ | ||
-Waggregate-return \ | ||
-Wcast-align \ | ||
-Wstrict-prototypes \ | ||
-Wold-style-definition \ | ||
-Wmissing-prototypes \ | ||
-Wmissing-declarations \ | ||
-Wpacked \ | ||
-Wredundant-decls \ | ||
-Wnested-externs \ | ||
-Winline \ | ||
-Winvalid-pch \ | ||
-Wstack-protector | ||
|
||
TARGETS=remux_example | ||
|
||
all: $(TARGETS) | ||
|
||
remux_example: remux_example.c \ | ||
../../videostreamer.c ../../videostreamer.h | ||
$(CC) $(CFLAGS) -I../../ -o $@ $< ../../videostreamer.c -lavformat \ | ||
-lavdevice -lavcodec -lavutil | ||
|
||
clean: | ||
rm -f $(TARGETS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#include <stdbool.h> | ||
#include <stdio.h> | ||
#include <videostreamer.h> | ||
|
||
int main(const int argc, const char * const argv) | ||
{ | ||
if (argc != 2) { | ||
printf("Usage: %s <rtsp URL>\n", argv[0]); | ||
return 1; | ||
} | ||
|
||
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"; | ||
const bool verbose = true; | ||
|
||
struct Videostreamer * const vs = vs_open(input_format, input_url, | ||
output_format, output_url, verbose); | ||
if (!vs) { | ||
printf("unable to open videostreamer\n"); | ||
return 1; | ||
} | ||
|
||
const int max_frames = 100; | ||
int i = 0; | ||
|
||
while (1) { | ||
const int frame_size = vs_read_write(vs, verbose); | ||
if (frame_size == -1) { | ||
printf("read/write failed\n"); | ||
vs_destroy(vs); | ||
return 1; | ||
} | ||
|
||
printf("frame size %d\n", frame_size); | ||
|
||
i++; | ||
if (i == max_frames) { | ||
break; | ||
} | ||
} | ||
|
||
vs_destroy(vs); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Now playing</title> | ||
|
||
<meta name="viewport" content="width=device-width, user-scalable=no"> | ||
|
||
<style> | ||
video { | ||
max-width: 100%; | ||
} | ||
</style> | ||
|
||
<h1>Now playing</h1> | ||
|
||
<!--src="http://127.0.0.1:8081/stream" --> | ||
<!-- src="out.mp4" --> | ||
<video | ||
src="http://127.0.0.1:8081/stream" | ||
autoplay | ||
controls | ||
></video> |
Oops, something went wrong.