Move scripts to script dir, add youtube-hls-stream script, fix twitch stream script
This commit is contained in:
parent
59b730a806
commit
85cd5a9d11
@ -23,7 +23,7 @@ If you use a distro that isn't user friendly, such as fedora, then you can also
|
|||||||
Recording monitors requires a gpu with NvFBC support (note: this is not required when recording a single window!). Normally only tesla and quadro gpus support this, but by using [nvidia-patch](https://github.com/keylase/nvidia-patch) or [nvlax](https://github.com/illnyang/nvlax) you can do this on all gpus that support nvenc as well (gpus as old as the nvidia 600 series), provided you are not using outdated gpu drivers.
|
Recording monitors requires a gpu with NvFBC support (note: this is not required when recording a single window!). Normally only tesla and quadro gpus support this, but by using [nvidia-patch](https://github.com/keylase/nvidia-patch) or [nvlax](https://github.com/illnyang/nvlax) you can do this on all gpus that support nvenc as well (gpus as old as the nvidia 600 series), provided you are not using outdated gpu drivers.
|
||||||
|
|
||||||
# How to use
|
# How to use
|
||||||
Run `interactive.sh` or run gpu-screen-recorder directly, for example: `gpu-screen-recorder -w $(xdotool selectwindow) -c mp4 -f 60 -a "$(pactl get-default-sink).monitor" -o test_video.mp4`\
|
Run `scripts/interactive.sh` or run gpu-screen-recorder directly, for example: `gpu-screen-recorder -w $(xdotool selectwindow) -c mp4 -f 60 -a "$(pactl get-default-sink).monitor" -o test_video.mp4`\
|
||||||
Then stop the screen recorder with Ctrl+C, which will also save the recording.\
|
Then stop the screen recorder with Ctrl+C, which will also save the recording.\
|
||||||
Send signal SIGUSR1 (`killall -SIGUSR1 gpu-screen-recorder`) to gpu-screen-recorder when in replay mode to save the replay. The paths to the saved files is output to stdout after the recording is saved.\
|
Send signal SIGUSR1 (`killall -SIGUSR1 gpu-screen-recorder`) to gpu-screen-recorder when in replay mode to save the replay. The paths to the saved files is output to stdout after the recording is saved.\
|
||||||
You can find the default output audio device (headset, speakers) with the command `pactl get-default-sink`. Add `monitor` to the end of that to use that as an audio input in gpu-screen-recorder.\
|
You can find the default output audio device (headset, speakers) with the command `pactl get-default-sink`. Add `monitor` to the end of that to use that as an audio input in gpu-screen-recorder.\
|
||||||
|
@ -14,4 +14,4 @@ read output_file_name
|
|||||||
output_dir=$(dirname "$output_file_name")
|
output_dir=$(dirname "$output_file_name")
|
||||||
mkdir -p "$output_dir"
|
mkdir -p "$output_dir"
|
||||||
|
|
||||||
./gpu-screen-recorder -w "$window_id" -c mp4 -f "$fps" -a "$selected_audio_input" -o "$output_file_name"
|
gpu-screen-recorder -w "$window_id" -c mp4 -f "$fps" -a "$selected_audio_input" -o "$output_file_name"
|
@ -3,4 +3,4 @@
|
|||||||
[ "$#" -ne 4 ] && echo "usage: replay.sh <window_id> <fps> <replay_time_sec> <output_directory>" && exit 1
|
[ "$#" -ne 4 ] && echo "usage: replay.sh <window_id> <fps> <replay_time_sec> <output_directory>" && exit 1
|
||||||
active_sink="$(pactl get-default-sink).monitor"
|
active_sink="$(pactl get-default-sink).monitor"
|
||||||
mkdir -p "$4"
|
mkdir -p "$4"
|
||||||
./gpu-screen-recorder -w "$1" -c mp4 -f "$2" -a "$active_sink" -r "$3" -o "$4"
|
gpu-screen-recorder -w "$1" -c mp4 -f "$2" -a "$active_sink" -r "$3" -o "$4"
|
@ -4,4 +4,4 @@
|
|||||||
|
|
||||||
[ "$#" -ne 4 ] && echo "usage: twitch-stream-local-copy.sh <window_id> <fps> <livestream_key> <local_file>" && exit 1
|
[ "$#" -ne 4 ] && echo "usage: twitch-stream-local-copy.sh <window_id> <fps> <livestream_key> <local_file>" && exit 1
|
||||||
active_sink="$(pactl get-default-sink).monitor"
|
active_sink="$(pactl get-default-sink).monitor"
|
||||||
./gpu-screen-recorder -w "$1" -c flv -f "$2" -a "$active_sink" | tee -- "$4" | ffmpeg -i pipe:0 -c:v copy -f flv -- "rtmp://live.twitch.tv/app/$3"
|
gpu-screen-recorder -w "$1" -c flv -f "$2" -a "$active_sink" | tee -- "$4" | ffmpeg -i pipe:0 -c copy -f flv -- "rtmp://live.twitch.tv/app/$3"
|
@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
[ "$#" -ne 3 ] && echo "usage: twitch-stream.sh <window_id> <fps> <livestream_key>" && exit 1
|
[ "$#" -ne 3 ] && echo "usage: twitch-stream.sh <window_id> <fps> <livestream_key>" && exit 1
|
||||||
active_sink="$(pactl get-default-sink).monitor"
|
active_sink="$(pactl get-default-sink).monitor"
|
||||||
./gpu-screen-recorder -w "$1" -c flv -f "$2" -a "$active_sink" "rtmp://live.twitch.tv/app/$3"
|
gpu-screen-recorder -w "$1" -c flv -f "$2" -a "$active_sink" -o "rtmp://live.twitch.tv/app/$3"
|
11
scripts/youtube-hls-stream.sh
Executable file
11
scripts/youtube-hls-stream.sh
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
[ "$#" -ne 3 ] && echo "usage: youtube-hls-stream.sh <window_id> <fps> <livestream_key>" && exit 1
|
||||||
|
mkdir "youtube_stream"
|
||||||
|
cd "youtube_stream"
|
||||||
|
active_sink="$(pactl get-default-sink).monitor"
|
||||||
|
gpu-screen-recorder -w "$1" -c mpegts -f "$2" -a "$active_sink" | ffmpeg -i pipe:0 -c copy -f hls \
|
||||||
|
-hls_time 2 -hls_flags independent_segments -hls_flags delete_segments -hls_segment_type mpegts -hls_segment_filename stream%02d.ts -master_pl_name stream.m3u8 out1 &
|
||||||
|
echo "Waiting until stream segments are created..."
|
||||||
|
sleep 10
|
||||||
|
ffmpeg -i stream.m3u8 -c copy -- "https://a.upload.youtube.com/http_upload_hls?cid=$3©=0&file=stream.m3u8"
|
@ -533,6 +533,8 @@ static AVCodecContext *create_video_codec_context(AVFormatContext *av_format_con
|
|||||||
codec_context->max_b_frames = 0;
|
codec_context->max_b_frames = 0;
|
||||||
codec_context->pix_fmt = AV_PIX_FMT_CUDA;
|
codec_context->pix_fmt = AV_PIX_FMT_CUDA;
|
||||||
codec_context->color_range = AVCOL_RANGE_JPEG;
|
codec_context->color_range = AVCOL_RANGE_JPEG;
|
||||||
|
if(use_hevc)
|
||||||
|
codec_context->codec_tag = MKTAG('h', 'v', 'c', '1');
|
||||||
switch(video_quality) {
|
switch(video_quality) {
|
||||||
case VideoQuality::MEDIUM:
|
case VideoQuality::MEDIUM:
|
||||||
codec_context->bit_rate = 10000000 + (codec_context->width * codec_context->height) / 2;
|
codec_context->bit_rate = 10000000 + (codec_context->width * codec_context->height) / 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user