Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package wf-recorder for openSUSE:Factory checked in at 2023-01-17 17:35:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/wf-recorder (Old) and /work/SRC/openSUSE:Factory/.wf-recorder.new.32243 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "wf-recorder" Tue Jan 17 17:35:45 2023 rev:4 rq:1058885 version:0.3.0+git19 Changes: -------- --- /work/SRC/openSUSE:Factory/wf-recorder/wf-recorder.changes 2022-09-13 16:47:53.474267621 +0200 +++ /work/SRC/openSUSE:Factory/.wf-recorder.new.32243/wf-recorder.changes 2023-01-17 17:35:54.465386143 +0100 @@ -1,0 +2,17 @@ +Tue Jan 17 11:40:17 UTC 2023 - [email protected] + +- Update to version 0.3.0+git19: + * Gracefully terminate on SIGTERM/SIGHUP to avoid corruption (#183) + * Fix meson deprecation warning + * Replace deprecated av_init_packet() calls + * FrameRate Changes, Implement CFR and estimated buffer framerate (#190) + * Use VP8+Vorbis on WebM for recordings (#202) + * Add GitHub Actions CI to test the build (#201) + * README: Flesh out build dependencies for building from source (#203) + * build: Fix compile failure introduced by last commit (#200) + * Add a compile-time option to set the default container file format + * README: Update Fedora build and install documentation + * Use VP9+Opus on MKV for recordings + * Add default codec parameters for libvpx/libvpx-vp9. (#197) + +------------------------------------------------------------------- Old: ---- wf-recorder-0.3.0+git7.tar.gz New: ---- wf-recorder-0.3.0+git19.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ wf-recorder.spec ++++++ --- /var/tmp/diff_new_pack.erwVoQ/_old 2023-01-17 17:35:55.141389956 +0100 +++ /var/tmp/diff_new_pack.erwVoQ/_new 2023-01-17 17:35:55.145389978 +0100 @@ -1,7 +1,7 @@ # # spec file for package wf-recorder # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # Copyright (c) 2018 Michael Aquilina # # All modifications and additions to the file contributed by third parties @@ -18,7 +18,7 @@ Name: wf-recorder -Version: 0.3.0+git7 +Version: 0.3.0+git19 Release: 0%{?dist} Summary: Utility program for screen recording of wlroots-based compositors License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.erwVoQ/_old 2023-01-17 17:35:55.177390159 +0100 +++ /var/tmp/diff_new_pack.erwVoQ/_new 2023-01-17 17:35:55.181390181 +0100 @@ -2,7 +2,7 @@ <service name="obs_scm" mode="disabled"> <param name="scm">git</param> <param name="url">https://github.com/ammen99/wf-recorder.git</param> - <param name="revision">bb7aff7a52598b70b87da351822e8e58caa1a973</param> + <param name="revision">460d454b1efd380a3f732f6fd70c7a5e265381f6</param> <param name="versionformat">@PARENT_TAG@+git@TAG_OFFSET@</param> <param name="versionrewrite-pattern">v(.*)</param> <param name="versionrewrite-replacement">\1</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.erwVoQ/_old 2023-01-17 17:35:55.201390293 +0100 +++ /var/tmp/diff_new_pack.erwVoQ/_new 2023-01-17 17:35:55.201390293 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/ammen99/wf-recorder.git</param> - <param name="changesrevision">bb7aff7a52598b70b87da351822e8e58caa1a973</param></service></servicedata> + <param name="changesrevision">460d454b1efd380a3f732f6fd70c7a5e265381f6</param></service></servicedata> (No newline at EOF) ++++++ wf-recorder-0.3.0+git7.tar.gz -> wf-recorder-0.3.0+git19.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wf-recorder-0.3.0+git7/.github/workflows/build.yaml new/wf-recorder-0.3.0+git19/.github/workflows/build.yaml --- old/wf-recorder-0.3.0+git7/.github/workflows/build.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/wf-recorder-0.3.0+git19/.github/workflows/build.yaml 2023-01-02 10:18:42.000000000 +0100 @@ -0,0 +1,30 @@ +name: Build + +on: [push, pull_request] + +jobs: + linux: + runs-on: ubuntu-latest + + container: registry.fedoraproject.org/fedora:latest + + steps: + - name: Set up DNF download cache + id: dnf-cache + uses: actions/cache@v3 + with: + path: /var/cache/dnf + key: ${{ runner.os }}-dnfcache + - name: Install pre-requisites + run: dnf --assumeyes --setopt=install_weak_deps=False install + gcc-c++ meson /usr/bin/git /usr/bin/wayland-scanner + 'pkgconfig(wayland-client)' 'pkgconfig(wayland-protocols)' 'pkgconfig(libpulse-simple)' + 'pkgconfig(libavutil)' 'pkgconfig(libavcodec)' 'pkgconfig(libavformat)' + 'pkgconfig(libavdevice)' 'pkgconfig(libavfilter)' 'pkgconfig(libswresample)' + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Shallow clones speed things up + - name: meson configure + run: meson ./Build + - name: compile with ninja + run: ninja -C ./Build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wf-recorder-0.3.0+git7/README.md new/wf-recorder-0.3.0+git19/README.md --- old/wf-recorder-0.3.0+git7/README.md 2022-08-11 10:23:46.000000000 +0200 +++ new/wf-recorder-0.3.0+git19/README.md 2023-01-02 10:18:42.000000000 +0100 @@ -32,7 +32,7 @@ ## Fedora Linux -Fedora users can install from rpmfusion-free-updates. First [enable rpmfusion](https://rpmfusion.org/Configuration) and then +Fedora users can install wf-recorder from the official repos ``` sudo dnf install wf-recorder ``` @@ -49,12 +49,12 @@ #### Ubuntu ``` -sudo apt install libavutil-dev libavcodec-dev libavformat-dev libswscale-dev libpulse-dev +sudo apt install g++ meson libavutil-dev libavcodec-dev libavformat-dev libswscale-dev libpulse-dev ``` #### Fedora ``` -$ sudo dnf install wayland-devel wayland-protocols-devel ffmpeg-devel +$ sudo dnf install gcc-c++ meson wayland-devel wayland-protocols-devel ffmpeg-free-devel pulseaudio-libs-devel ``` ### Download & Build @@ -63,12 +63,12 @@ meson build --prefix=/usr --buildtype=release ninja -C build ``` -Optionally configure with `-Ddefault_codec='codec'`. The default is libx264. Now you can just run `./build/wf-recorder` or install it with `sudo ninja -C build install`. +Optionally configure with `-Ddefault_codec='codec'`. The default is libvpx. Now you can just run `./build/wf-recorder` or install it with `sudo ninja -C build install`. The man page can be read with `man ./manpage/wf-recorder.1`. # Usage -In its simplest form, run `wf-recorder` to start recording and use Ctrl+C to stop. This will create a file called `recording.mp4` in the current working directory using the default codec. +In its simplest form, run `wf-recorder` to start recording and use Ctrl+C to stop. This will create a file called `recording.webm` in the current working directory using the default codec. Use `-f <filename>` to specify the output file. In case of multiple outputs, you'll first be prompted to select the output you want to record. If you know the output name beforehand, you can use the `-o <output name>` option. @@ -81,7 +81,7 @@ You can record screen and sound simultaneously with ``` -wf-recorder --audio --file=recording_with_audio.mp4 +wf-recorder --audio --file=recording_with_audio.webm ``` To specify an audio device, use the `-a<device>` or `--audio=<device>` options. @@ -108,8 +108,8 @@ wf-recorder --muxer=v4l2 --codec=rawvideo --file=/dev/video2 ``` -To use GPU encoding, use a VAAPI codec (for ex. `h264_vaapi`) and specify a GPU device to use with the `-d` option: +To use GPU encoding, use a VAAPI codec (for ex. `vp8_vaapi`) and specify a GPU device to use with the `-d` option: ``` -wf-recorder -f test-vaapi.mkv -c h264_vaapi -d /dev/dri/renderD128 +wf-recorder -f test-vaapi.webm -c vp8_vaapi -d /dev/dri/renderD128 ``` Some drivers report support for rgb0 data for vaapi input but really only support yuv planar formats. In this case, use the `-x yuv420p` or `--pixel-format yuv420p` option in addition to the vaapi options to convert the data to yuv planar data before sending it to the GPU. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wf-recorder-0.3.0+git7/config.h.in new/wf-recorder-0.3.0+git19/config.h.in --- old/wf-recorder-0.3.0+git7/config.h.in 2022-08-11 10:23:46.000000000 +0200 +++ new/wf-recorder-0.3.0+git19/config.h.in 2023-01-02 10:18:42.000000000 +0100 @@ -1,9 +1,9 @@ #pragma once #define DEFAULT_CODEC "@default_codec@" -#define DEFAULT_FRAMERATE @default_framerate@ #define DEFAULT_AUDIO_CODEC "@default_audio_codec@" #define DEFAULT_AUDIO_SAMPLE_RATE @default_audio_sample_rate@ +#define DEFAULT_CONTAINER_FORMAT "@default_container_format@" #define FALLBACK_AUDIO_SAMPLE_FMT "@fallback_audio_sample_fmt@" #mesondefine HAVE_PULSE #mesondefine HAVE_OPENCL diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wf-recorder-0.3.0+git7/manpage/wf-recorder.1 new/wf-recorder-0.3.0+git19/manpage/wf-recorder.1 --- old/wf-recorder-0.3.0+git7/manpage/wf-recorder.1 2022-08-11 10:23:46.000000000 +0200 +++ new/wf-recorder-0.3.0+git19/manpage/wf-recorder.1 2023-01-02 10:18:42.000000000 +0100 @@ -9,6 +9,7 @@ .Op Fl abcCdDefFghlmopPrRvxX .Op Fl a, -audio Op Ar =DEVICE .Op Fl b, -bframes Ar max_b_frames +.Op Fl B, -buffrate Ar buffrate .Op Fl c, -codec Ar output_codec .Op Fl r, -framerate Ar framerate .Op Fl d, -device Ar encoding_device @@ -42,7 +43,7 @@ .Ql Ctrl+C to stop. This will create a file called -.Ql recording.mp4 +.Ql recording.webm in the current working directory using the default .Ar codec. .Pp @@ -61,6 +62,10 @@ .Pp .It Fl b , -bframes Ar max_b_frames Sets the maximum number of B-Frames to use. +.It Fl B , -buffrate Ar buffrate +Tells the encoder a prediction of what framerate to expect. +This preserves VFR and Solves FPS limit issue of some encoders (like svt-av1). +Should be set to the same framerate as display. .Pp .It Fl c , -codec Ar output_codec Specifies the codec of the video. Supports GIF output as well. @@ -69,7 +74,8 @@ .Fl p Ar option_name=option_value .Pp .It Fl r , -framerate Ar framerate -Changes an approximation of the video framerate. The default is 60. +Sets hard constant framerate. Will duplicate frames to reach it. +This makes the resulting video CFR. Solves FPS limit issue of some encoders. .Pp .It Fl d , -device Ar encoding_device Selects the device to use when encoding the video. @@ -159,7 +165,7 @@ .Dl $ wf-recorder -g "$(slurp)" .Pp You can record screen and sound simultaneously with -.Dl $ wf-recorder --audio --file=recording_with_audio.mp4 +.Dl $ wf-recorder --audio --file=recording_with_audio.webm .Pp To specify an audio device, use the .Fl -a<DEVICE> @@ -184,12 +190,12 @@ .Dl $ wf-recorder --muxer=v4l2 --codec=rawvideo --file=/dev/video2 .Pp To use GPU encoding, use a VAAPI codec (for ex. -.Ql h264_vaapi +.Ql vp8_vaapi ) and specify a GPU device to use with the .Fl d option: -.Dl $ wf-recorder -f test-vaapi.mkv -c h264_vaapi -d /dev/dri/renderD128 +.Dl $ wf-recorder -f test-vaapi.webm -c vp8_vaapi -d /dev/dri/renderD128 .Pp Some drivers report support for .Ql rgb0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wf-recorder-0.3.0+git7/meson.build new/wf-recorder-0.3.0+git19/meson.build --- old/wf-recorder-0.3.0+git7/meson.build 2022-08-11 10:23:46.000000000 +0200 +++ new/wf-recorder-0.3.0+git19/meson.build 2023-01-02 10:18:42.000000000 +0100 @@ -4,7 +4,7 @@ 'cpp', version: '0.3.0', license: 'MIT', - meson_version: '>=0.47.0', + meson_version: '>=0.54.0', default_options: [ 'cpp_std=c++11', 'c_std=c11', @@ -16,16 +16,16 @@ conf_data = configuration_data() conf_data.set('default_codec', get_option('default_codec')) -conf_data.set('default_framerate', get_option('default_framerate')) conf_data.set('default_audio_codec', get_option('default_audio_codec')) conf_data.set('default_audio_sample_rate', get_option('default_audio_sample_rate')) +conf_data.set('default_container_format', get_option('default_container_format')) conf_data.set('fallback_audio_sample_fmt', get_option('fallback_audio_sample_fmt')) version = '"@0@"'.format(meson.project_version()) git = find_program('git', native: true, required: false) if git.found() - git_commit = run_command([git, 'rev-parse', '--short', 'HEAD']) - git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD']) + git_commit = run_command([git, 'rev-parse', '--short', 'HEAD'], check: true) + git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD'], check: true) if git_commit.returncode() == 0 and git_branch.returncode() == 0 version = '"@0@-@1@ (" __DATE__ ", branch \'@2@\')"'.format( meson.project_version(), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wf-recorder-0.3.0+git7/meson_options.txt new/wf-recorder-0.3.0+git19/meson_options.txt --- old/wf-recorder-0.3.0+git7/meson_options.txt 2022-08-11 10:23:46.000000000 +0200 +++ new/wf-recorder-0.3.0+git19/meson_options.txt 2023-01-02 10:18:42.000000000 +0100 @@ -1,6 +1,6 @@ -option('default_codec', type: 'string', value: 'libx264', description: 'Codec that will be used by default') -option('default_framerate', type: 'integer', value: 60, description: 'Video framerate that will be used by default') -option('default_audio_codec', type: 'string', value: 'aac', description: 'Audio codec that will be used by default') +option('default_codec', type: 'string', value: 'libvpx', description: 'Codec that will be used by default') +option('default_audio_codec', type: 'string', value: 'libvorbis', description: 'Audio codec that will be used by default') option('default_audio_sample_rate', type: 'integer', value: 48000, description: 'Audio sample rate that will be used by default') +option('default_container_format', type: 'string', value: 'webm', description: 'Container file format that will be used by default') option('fallback_audio_sample_fmt', type: 'string', value: 's16', description: 'Fallback audio sample format that will be used if wf-recorder cannot determine the sample formats supported by a codec') option('pulse', type: 'feature', value: 'auto', description: 'Enable Pulseaudio') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wf-recorder-0.3.0+git7/proto/meson.build new/wf-recorder-0.3.0+git19/proto/meson.build --- old/wf-recorder-0.3.0+git7/proto/meson.build 2022-08-11 10:23:46.000000000 +0200 +++ new/wf-recorder-0.3.0+git19/proto/meson.build 2023-01-02 10:18:42.000000000 +0100 @@ -1,4 +1,4 @@ -wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir') +wl_protocol_dir = wayland_protos.get_variable(pkgconfig: 'pkgdatadir', internal: 'pkgdatadir') wayland_scanner = find_program('wayland-scanner') wayland_scanner_code = generator( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wf-recorder-0.3.0+git7/src/frame-writer.cpp new/wf-recorder-0.3.0+git19/src/frame-writer.cpp --- old/wf-recorder-0.3.0+git7/src/frame-writer.cpp 2022-08-11 10:23:46.000000000 +0200 +++ new/wf-recorder-0.3.0+git19/src/frame-writer.cpp 2023-01-02 10:18:42.000000000 +0100 @@ -44,19 +44,35 @@ void FrameWriter::load_codec_options(AVDictionary **dict) { - static const std::map<std::string, std::string> default_x264_options = { - {"tune", "zerolatency"}, - {"preset", "ultrafast"}, - {"crf", "20"}, + using CodecOptions = std::map<std::string, std::string>; + + static const CodecOptions default_x264_options = { + {"tune", "zerolatency"}, + {"preset", "ultrafast"}, + {"crf", "20"}, + }; + + static const CodecOptions default_libvpx_options = { + {"cpu-used", "5"}, + {"deadline", "realtime"}, }; - if (params.codec.find("libx264") != std::string::npos || - params.codec.find("libx265") != std::string::npos) + static const std::map<std::string, const CodecOptions&> default_codec_options = { + {"libx264", default_x264_options}, + {"libx265", default_x264_options}, + {"libvpx", default_libvpx_options}, + }; + + for (const auto& opts : default_codec_options) { - for (const auto& param : default_x264_options) + if (params.codec.find(opts.first) != std::string::npos) { - if (!params.codec_options.count(param.first)) - params.codec_options[param.first] = param.second; + for (const auto& param : opts.second) + { + if (!params.codec_options.count(param.first)) + params.codec_options[param.first] = param.second; + } + break; } } @@ -161,6 +177,15 @@ } } + if (params.framerate != 0){ + if (params.video_filter != "null" && params.video_filter.find("fps") == std::string::npos) { + params.video_filter += ",fps=" + std::to_string(params.framerate); + } + else if (params.video_filter == "null"){ + params.video_filter = "fps=" + std::to_string(params.framerate); + } + } + this->videoFilterGraph = avfilter_graph_alloc(); av_opt_set(videoFilterGraph, "scale_sws_opts", "flags=fast_bilinear:src_range=1:dst_range=1", 0); @@ -179,6 +204,9 @@ buffer_filter_config << "video_size=" << params.width << "x" << params.height; buffer_filter_config << ":pix_fmt=" << (int)this->get_input_format(); buffer_filter_config << ":time_base=" << US_RATIONAL.num << "/" << US_RATIONAL.den; + if (params.buffrate != 0) { + buffer_filter_config << ":frame_rate=" << params.buffrate; + } buffer_filter_config << ":pixel_aspect=1/1"; int err = avfilter_graph_create_filter(&this->videoFilterSourceCtx, source, @@ -314,7 +342,9 @@ videoCodecCtx->height = params.height; videoCodecCtx->time_base = US_RATIONAL; videoCodecCtx->color_range = AVCOL_RANGE_JPEG; + if (params.framerate) { std::cout << "Framerate: " << params.framerate << std::endl; + } if (params.bframes != -1) videoCodecCtx->max_b_frames = params.bframes; @@ -644,13 +674,13 @@ filtered_frame->pict_type = AV_PICTURE_TYPE_NONE; // So we have a frame. Encode it! - AVPacket pkt; - av_init_packet(&pkt); - pkt.data = NULL; - pkt.size = 0; + AVPacket *pkt = av_packet_alloc(); + pkt->data = NULL; + pkt->size = 0; - encode(videoCodecCtx, filtered_frame, &pkt); + encode(videoCodecCtx, filtered_frame, pkt); av_frame_free(&filtered_frame); + av_packet_free(&pkt); } av_frame_free(&frame); @@ -678,12 +708,12 @@ void FrameWriter::send_audio_pkt(AVFrame *frame) { - AVPacket pkt; - av_init_packet(&pkt); - pkt.data = NULL; - pkt.size = 0; + AVPacket *pkt = av_packet_alloc(); + pkt->data = NULL; + pkt->size = 0; - encode(audioCodecCtx, frame, &pkt); + encode(audioCodecCtx, frame, pkt); + av_packet_free(&pkt); } size_t FrameWriter::get_audio_buffer_size() @@ -758,14 +788,13 @@ FrameWriter::~FrameWriter() { // Writing the delayed frames: - AVPacket pkt; - av_init_packet(&pkt); + AVPacket *pkt = av_packet_alloc(); - encode(videoCodecCtx, NULL, &pkt); + encode(videoCodecCtx, NULL, pkt); #ifdef HAVE_PULSE if (params.enable_audio) { - encode(audioCodecCtx, NULL, &pkt); + encode(audioCodecCtx, NULL, pkt); } #endif // Writing the end of the file. @@ -775,12 +804,13 @@ if (outputFmt && (!(outputFmt->flags & AVFMT_NOFILE))) avio_closep(&fmtCtx->pb); - avcodec_free_context(&videoCodecCtx); // Freeing all the allocated memory: + avcodec_free_context(&videoCodecCtx); #ifdef HAVE_PULSE if (params.enable_audio) avcodec_free_context(&audioCodecCtx); #endif + av_packet_free(&pkt); // TODO: free all the hw accel avformat_free_context(fmtCtx); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wf-recorder-0.3.0+git7/src/frame-writer.hpp new/wf-recorder-0.3.0+git19/src/frame-writer.hpp --- old/wf-recorder-0.3.0+git7/src/frame-writer.hpp 2022-08-11 10:23:46.000000000 +0200 +++ new/wf-recorder-0.3.0+git19/src/frame-writer.hpp 2023-01-02 10:18:42.000000000 +0100 @@ -60,8 +60,9 @@ std::string hw_device; // used only if codec contains vaapi std::map<std::string, std::string> codec_options; std::map<std::string, std::string> audio_codec_options; - int framerate; + int framerate = 0; int sample_rate; + int buffrate = 0; int64_t audio_sync_offset; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wf-recorder-0.3.0+git7/src/main.cpp new/wf-recorder-0.3.0+git19/src/main.cpp --- old/wf-recorder-0.3.0+git7/src/main.cpp 2022-08-11 10:23:46.000000000 +0200 +++ new/wf-recorder-0.3.0+git19/src/main.cpp 2023-01-02 10:18:42.000000000 +0100 @@ -32,6 +32,8 @@ #define MAX_FRAME_FAILURES 16 +static const int GRACEFUL_TERMINATION_SIGNALS[] = { SIGTERM, SIGINT, SIGHUP }; + std::mutex frame_writer_mutex, frame_writer_pending_mutex; std::unique_ptr<FrameWriter> frame_writer; @@ -327,10 +329,13 @@ static void write_loop(FrameWriterParams params) { - /* Ignore SIGINT, main loop is responsible for the exit_main_loop signal */ + /* Ignore SIGTERM/SIGINT/SIGHUP, main loop is responsible for the exit_main_loop signal */ sigset_t sigset; sigemptyset(&sigset); - sigaddset(&sigset, SIGINT); + for (auto signo : GRACEFUL_TERMINATION_SIGNALS) + { + sigaddset(&sigset, signo); + } pthread_sigmask(SIG_BLOCK, &sigset, NULL); int last_encoded_frame = 0; @@ -393,7 +398,7 @@ frame_writer = nullptr; } -void handle_sigint(int) +void handle_graceful_termination(int) { exit_main_loop = true; } @@ -561,7 +566,7 @@ ffmpeg -encoders To modify codec parameters, use -p <option_name>=<option_value> - -r, --framerate Changes an approximation of the video framerate. The default is 60. + -r, --framerate Changes framerate to constant framerate with a given value. -d, --device Selects the device to use when encoding the video Some drivers report support for rgb0 data for vaapi input but @@ -604,6 +609,9 @@ -b, --bframes This option is used to set the maximum number of b-frames to be used. If b-frames are not supported by your hardware, set this to 0. + + -B. --buffrate This option is used to specify the buffers expected framerate. this + may help when encoders are expecting specifc or limited framerate. -C, --audio-codec Specifies the codec of the audio. These can be found by running: ffmpeg -encoders @@ -626,7 +634,7 @@ printf(R"( - wf-recorder Records the video. Use Ctrl+C to stop recording. - The video file will be stored as recording.mp4 in the + The video file will be stored as recording.webm in the current working directory. - wf-recorder -f <filename>.ext Records the video. Use Ctrl+C to stop recording. @@ -638,7 +646,7 @@ Video and Audio: - wf-recorder -a Records the video and audio. Use Ctrl+C to stop recording. - The video file will be stored as recording.mp4 in the + The video file will be stored as recording.webm in the current working directory. - wf-recorder -a -f <filename>.ext Records the video and audio. Use Ctrl+C to stop recording. @@ -697,9 +705,8 @@ int main(int argc, char *argv[]) { FrameWriterParams params = FrameWriterParams(exit_main_loop); - params.file = "recording.mp4"; + params.file = "recording." + std::string(DEFAULT_CONTAINER_FORMAT); params.codec = DEFAULT_CODEC; - params.framerate = DEFAULT_FRAMERATE; params.audio_codec = DEFAULT_AUDIO_CODEC; params.sample_rate = DEFAULT_AUDIO_SAMPLE_RATE; params.enable_ffmpeg_debug_output = false; @@ -728,13 +735,14 @@ { "audio", optional_argument, NULL, 'a' }, { "help", no_argument, NULL, 'h' }, { "bframes", required_argument, NULL, 'b' }, + { "buffrate", required_argument, NULL, 'B' }, { "version", no_argument, NULL, 'v' }, { "no-damage", no_argument, NULL, 'D' }, { 0, 0, NULL, 0 } }; int c, i; - while((c = getopt_long(argc, argv, "o:f:m:g:c:p:r:x:C:P:R:X:d:b:la::hvDF:", opts, &i)) != -1) + while((c = getopt_long(argc, argv, "o:f:m:g:c:p:r:x:C:P:R:X:d:b:B:la::hvDF:", opts, &i)) != -1) { switch(c) { @@ -790,6 +798,10 @@ params.bframes = atoi(optarg); break; + case 'B': + params.buffrate = atoi(optarg); + break; + case 'l': params.enable_ffmpeg_debug_output = true; break; @@ -920,7 +932,10 @@ bool spawned_thread = false; std::thread writer_thread; - signal(SIGINT, handle_sigint); + for (auto signo : GRACEFUL_TERMINATION_SIGNALS) + { + signal(signo, handle_graceful_termination); + } while(!exit_main_loop) { ++++++ wf-recorder.obsinfo ++++++ --- /var/tmp/diff_new_pack.erwVoQ/_old 2023-01-17 17:35:55.277390722 +0100 +++ /var/tmp/diff_new_pack.erwVoQ/_new 2023-01-17 17:35:55.281390744 +0100 @@ -1,5 +1,5 @@ name: wf-recorder -version: 0.3.0+git7 -mtime: 1660206226 -commit: bb7aff7a52598b70b87da351822e8e58caa1a973 +version: 0.3.0+git19 +mtime: 1672651122 +commit: 460d454b1efd380a3f732f6fd70c7a5e265381f6
