Skip to content

Commit

Permalink
Merge pull request KonradIT#52 from helmut-steiner/master
Browse files Browse the repository at this point in the history
Create a local stream for use in e.g. OBS Studio
  • Loading branch information
KonradIT authored Apr 14, 2020
2 parents e37a7a6 + 82c3914 commit f8428d7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions GoProStream.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def get_command_msg(id):
VERBOSE=False
## Sends Record command to GoPro Camera, must be in Video mode!
RECORD=False
## Converts GoPro camera live stream via FFMPEG to a local source, must be in Video mode!
STREAM=False
##
## Saves the feed to a custom location
SAVE=False
Expand Down Expand Up @@ -97,7 +99,10 @@ def gopro_live():
if VERBOSE==False:
loglevel_verbose = "-loglevel panic"
if SAVE == False:
subprocess.Popen("ffplay " + loglevel_verbose + " -fflags nobuffer -f:v mpegts -probesize 8192 udp://10.5.5.100:8554", shell=True)
if STREAM == True:
subprocess.Popen("ffmpeg " + loglevel_verbose + " -fflags nobuffer -f:v mpegts -probesize 8192 -i udp://10.5.5.100:8554 -f mpegts -vcodec copy udp://localhost:10000", shell=True)
else:
subprocess.Popen("ffplay " + loglevel_verbose + " -fflags nobuffer -f:v mpegts -probesize 8192 udp://10.5.5.100:8554", shell=True)
else:
if SAVE_FORMAT=="ts":
TS_PARAMS = " -acodec copy -vcodec copy "
Expand All @@ -107,7 +112,7 @@ def gopro_live():
print("Recording locally: " + str(SAVE))
print("Recording stored in: " + SAVELOCATION)
print("Note: Preview is not available when saving the stream.")
subprocess.Popen("ffmpeg -i 'udp://10.5.5.100:8554' -fflags nobuffer -f:v mpegts -probesize 8192 " + TS_PARAMS + SAVELOCATION, shell=True)
subprocess.Popen('ffmpeg -i "udp://10.5.5.100:8554" -fflags nobuffer -f:v mpegts -probesize 8192 ' + TS_PARAMS + SAVELOCATION, shell=True)
if sys.version_info.major >= 3:
MESSAGE = bytes(MESSAGE, "utf-8")
print("Press ctrl+C to quit this application.\n")
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ Verbose flag for FFmpeg

Sends a record command to the camera, camera must be in video mode!

STREAM=False

Creates a local stream via FFMPEG with minimized lag for use in OBS, camera must be in video mode!

SAVE=False

Save the gopro live feed to your machine
Expand Down

0 comments on commit f8428d7

Please sign in to comment.