Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-11-08Merge branch 'blender-v3.4-release'Sergey Sharybin
2022-11-08Fix deprecation warnings about printf() on macOSSergey Sharybin
The new Xcode 14.1 brings the new Apple Clang compiler which considers sprintf unsafe and geenrates deprecation warnings suggesting to sue snprintf instead. This only happens for C++ code by default, and C code can still use sprintf without any warning. This changes does the following: - Whenever is trivial replace sprintf() with BLI_snprintf. - For all other cases use the newly introduced BLI_sprintf which is a wrapper around sprintf() but without warning. There is a discouragement note in the BLI_sprintf comment to suggest use of BLI_snprintf when the size is known. Differential Revision: https://developer.blender.org/D16410
2022-11-07Fix support for building with ffmpeg < 5.0Sebastian Parborg
Seems like the new audio channel api was not as backwards compatible as we thought. Therefore we need to reintroduce the usage of the old api to make older ffmpeg version be able to compile Blender. This change is only intended to stick around for two releases or so. After that we hope that most Linux distros ship ffmpeg >=5.0 so we can switch to it. Reviewed By: Sergey Differential Revision: http://developer.blender.org/D16408
2022-11-03Fix deprecation warnings in FFmpeg related codeSergey Sharybin
The non-deprecated API dates back to 2017, so it should be safe to simply migrate to it. Fixes verbose error prints, making it easier to see actual issues. Differential Revision: https://developer.blender.org/D16370
2022-11-01Cleanup: spelling in commentsCampbell Barton
2022-10-29Cleanup: use STREQ macroCampbell Barton
2022-10-22Video rendering: FFMpeg AV1 codec encoding supportStephen Seo
Previously, the Blender video renderer did not have support for encoding video to AV1 (not to be confused with the container AVI). The proposed solution is to leverage the existing FFMpeg renderer to encode to AV1. Note that avcodec_find_encoder(AV_CODEC_ID_AV1) usually returns "libaom-av1" which is the "reference implementation" for AV1 encoding (the default for FFMpeg, and is slow). "libsvtav1" is faster and preferred so there is extra handling when fetching the AV1 codec for encoding such that "libsvtav1" is used when possible. This commit should only affect the options available for video rendering, which includes the additional AV1 codec to choose from, and setting "-crf". Also note that the current release of FFMpeg for ArchLinux does not support "-crf" for "libsvtav1", but the equivalent option "-qp" is supported and used as a fallback when "libsvtav1" is used (as mentioned here: https://trac.ffmpeg.org/wiki/Encode/AV1#SVT-AV1 ). (Actually, both "-crf" and "-qp" is specified with the same value in the code. When a release of FFMpeg obtains support for "-crf" for "libsvtav1" is released, the code shouldn't be needed to change.) The usage of the AV1 codec should be very similar to the usage of the H264 codec, but is limited to the "mp4" and "mkv" containers. This patch pertains to the "VFX & Video" module, as its main purpose is to supplement the Video Sequencer tool with the additional AV1 codec for encoded video output. Differential Revision: https://developer.blender.org/D14920 Reviewed By: sergey , ISS, zeddb
2022-09-26Cleanup: use 'u' prefixed integer types for brevity in C codeCampbell Barton
This also simplifies using function style casts when moving to C++.
2022-09-25Cleanup: use 'u' prefixed integer types for brevity & cast styleCampbell Barton
To use function style cast '(unsigned char)x' can't be replaced by 'unsigned char(x)'.
2022-07-15Cleanup: Use const pointers for ImageSaveOptions and ImageFormatDataJesse Yurkovich
Use const pointers to ImageSaveOptions and ImageFormatData for API parameters where appropriate. Differential Revision: https://developer.blender.org/D15400
2022-03-09Cleanup: use ELEM macroCampbell Barton
2022-02-22Cleanup: quiet warnings for FFMPEG before 5.0Campbell Barton
Even though 5.0 has been released newer distributions wont include it, so quiet warnings.
2022-02-22Revert "Cleanup: quiet const cast warning"Campbell Barton
This reverts commit 626fb290eb43eb43b9451c757b1e906f0b5eeb53. This was an intentional change for FFMPEG v5.0, removing the cast should be done in a version check instead.
2022-02-21Cleanup: quiet const cast warningCampbell Barton
2022-02-18Merge branch 'blender-v3.1-release'Sebastian Parborg
2022-02-18VSE: Refactor our code to be compatible with ffmpeg 5.0Sebastian Parborg
In ffmpeg 5.0, several variables were made const to try to prevent bad API usage. Removed some dead code that wasn't used anymore as well. Reviewed By: Richard Antalik Differential Revision: http://developer.blender.org/D14063
2022-02-11File headers: SPDX License migrationCampbell Barton
Use a shorter/simpler license convention, stops the header taking so much space. Follow the SPDX license specification: https://spdx.org/licenses - C/C++/objc/objc++ - Python - Shell Scripts - CMake, GNUmakefile While most of the source tree has been included - `./extern/` was left out. - `./intern/cycles` & `./intern/atomic` are also excluded because they use different header conventions. doc/license/SPDX-license-identifiers.txt has been added to list SPDX all used identifiers. See P2788 for the script that automated these edits. Reviewed By: brecht, mont29, sergey Ref D14069
2022-02-01Fix T93856: VP9 lossless render missing alphaRichard Antalik
Since 0ea0ccc4ffd5, `AV_PIX_FMT_YUV444P` pixel format was used for lossless renders, which did override `AV_PIX_FMT_YUVA420P` format when "RGBA" output is chosen. VP9 encoder doesn't seem to support `AV_PIX_FMT_YUVA444P` pixel format, so use `AV_PIX_FMT_YUVA420P` for lossless RGBA ouput instead. Reviewed By: sergey Differential Revision: https://developer.blender.org/D13947
2022-01-14Cleanup: Fix warning when compiling without AudaspaceJulian Eisel
2021-12-14Fix T91005: Autosplit produces unusable filesRichard Antalik
Audio PTS was reset for each new file. This caused misalignment of video and audio streams. In Blender, these files can't be loaded, other players will fail to align audio and video. Since timestamps are reset intentionally, reset also video stream timestamps. There were other bugs: After timestamp was reset for audio, write_audio_frames started encoding from timeline start until target frame, so each split video had more audio than it should. Also audio for last frame before splitting was written into new file. Differential Revision: https://developer.blender.org/D13280
2021-08-24FFMPEG: Fix building with older versions that need ↵Sebastian Parborg
FFMPEG_USE_DURATION_WORKAROUND
2021-08-16VSE: Fix "off by one" error when encoding audioSebastian Parborg
Before we didn't encode the audio up until the current frame. This lead to us not encoding the last video frame of audio. Reviewed By: Richard Antalik Differential Revision: http://developer.blender.org/D11918
2021-08-16VSE: Flush audio encode after finishing video exportSebastian Parborg
We didn't flush audio after encoding finished which lead to audio packets being lost. In addition to this the audio timestamps were wrong because we incremented the current audio time before using it. Reviewed By: Richard Antalik Differential Revision: http://developer.blender.org/D11916
2021-08-05Cleanup: remove redundant parenthesisCampbell Barton
2021-07-23Cleanup: code comments punctuation / spacingCampbell Barton
2021-06-10Cleanup: move endian values from BKE_global into BLI_endian_definesCampbell Barton
This change was prompted by D6408 which moves thumbnail extraction into a shared function that happens use these endian defines but only links blenlib. There is no need for these defines to be associated with globals so move into their own header.
2021-06-03Cleanup: make formatJacques Lucke
2021-06-02FFmpeg: Fix H264 lossless render not losslessRichard Antalik
While encoder parameters for lossless encoding are set correctly, output is not lossless due to pixel format being set to `AV_PIX_FMT_YUV420P` which is inherently lossy due to chroma subsampling. This was reported in T61569 and was merged to T57397, but there were 2 bugs - one for encoding and one for decoding. Set pixel format to `AV_PIX_FMT_YUV444P` when rendering lossless H264 files. This format isn't available in `codec->pix_fmts[0]` and it looks, that it has to be hard-coded. Reviewed By: sergey Differential Revision: D11458
2021-06-01Cleanup: spelling in commentsCampbell Barton
2021-05-31Fix T88623, T87044: Make encoded videos play correctly in VLCSebastian Parborg
The issue was two fold. We didn't properly: 1. Initialize the codec default values which would lead to VLC complaining because of garbage/wrong codec settings. 2.Calculate the time base for the video. FFmpeg would happily accept this but VLC seems to assume the time base value is at least somewhat correct and couldn't properly display the frames as the internal time base was huge. We are talking about 90k ticks (tbn) for one second of video! This patch initializes all codecs to use their default values and fixes the time base calculation so it follows the guidelines from ffmpeg. Reviewed By: Sergey, Richard Antalik Differential Revision: http://developer.blender.org/D11426
2021-05-28Make encoded video fps correct with ffmpeg < 4.4Sebastian Parborg
Before the FFmpeg commit: github.com/FFmpeg/FFmpeg/commit/1c0885334dda9ee8652e60c586fa2e3674056586 FFmpeg would use deprecated variables to calculate the video fps. We don't use these deprecated variables anymore, so ensure that the duration is correct in ffmpeg versions without this fix. Reviewed By: Sergey, Richard Antalik Differential Revision: http://developer.blender.org/D11417
2021-05-10Cleanup: unused variable warningCampbell Barton
2021-05-07Cleanup: Remove deprecated variables and functions calls from our ffmpeg codeSebastian Parborg
There need to be more cleanup for ffmpeg 4.5 (ffmpeg master branch). However this now compiles on ffmpeg 4.4 without and deprication warnings. Reviewed By: Sergey, Richard Antalik Differential Revision: http://developer.blender.org/D10338
2021-05-07Fix: No sound is exported with ffmpeg 4.4Sebastian Parborg
We were not assigning the amount of sound channels to the output frames. Newer ffmpeg releases has sanity checks in place and doesn't fall back to two channels anymore.
2021-03-26FFmpeg: improve threading settingsRichard Antalik
Generalize threading settings in proxy building and use them for encoding and decoding in general. Check codec capabilities, prefer FF_THREAD_FRAME threading over FF_THREAD_SLICE and automatic thread count over setting it explicitly. ffmpeg-codecs man page suggests that threads option is global and used by codecs, that supports this option. Form some tests I have done, it seems that `av_dict_set_int(&codec_opts, "threads", BLI_system_thread_count(), 0)` has same effect as ``` pCodecCtx->thread_count = BLI_system_thread_count(); pCodecCtx->thread_type = FF_THREAD_FRAME; ``` Looking at `ff_frame_thread_encoder_init()` code, these cases are not equivalent. It is probably safer to leave threading setup on libavcodec than setting up each codec threading individually. From what I have read all over the internet, frame multithreading should be faster than slice multithreading. Slice multithreading is mainly used for low latency streaming. When running Blender with --debug-ffmpeg it complains about `pCodecCtx->thread_count = BLI_system_thread_count()` that using thread count above 16 is not recommended. Using too many threads can negatively affect image quality, but I am not sure if this is the case for decoding as well - see https://streaminglearningcenter.com/blogs/ffmpeg-command-threads-how-it-affects-quality-and-performance.html This is fine for proxies but may be undesirable for final renders. Number of threads is limited by image size, because of size of motion vectors, so if it is possible let libavcodec determine optimal thread count. Performance difference: Proxy building: None Playback speed: 2x better on 1920x1080 sample h264 file Scrubbing: Hard to quantify, but it's much more responsive Rendering speed: None on 1920x1080 sample h264 file, there is improvement with codecs that do support FF_THREAD_FRAME for encoding like MPNG Reviewed By: sergey Differential Revision: https://developer.blender.org/D10791
2021-02-15FFmpeg: Improve multi-threading settingsSergey Sharybin
Allow use all system threads for frame encoding/decoding. This is very straightforward: the value of zero basically disables threading. Change threading policy to slice when decoding frames. The reason for this is because decoding happens frame-by-frame, so inter-frame threading policy will not bring any speedup. The change for threading policy to slice is less obvious and is based on benchmark of the demo files from T78986. This gives best performance so far. Rendering the following file went down from 190sec down to 160sec. https://storage.googleapis.com/institute-storage/vse_simplified_example.zip This change makes both reading and writing faster. The animation render is just easiest to get actual time metrics. Differential Revision: https://developer.blender.org/D8627
2020-10-19Fix T68343: Rendered video plays at 600fpsRichard Antalik
Field time_base of video stream must be set for some containers, otherwise avformat_write_header() will set it to default values. Rendered file in such case won't be played at desired frame rate. See init_muxer() in mux.c in ffpmeg sources. Reviewed By: sergey Differential Revision: https://developer.blender.org/D9213
2020-10-10Cleanup: use C comments for descriptive textCampbell Barton
Follow our code style guide by using C-comments for text descriptions.
2020-09-30Cleanup: convert gforge task ID's to phabricator formatValentin
Cleanup old tracker task format to the new. e.g: [#34039] to T34039 Ref D8718
2020-05-22Fix T74443: No render in VP9 lossless modePhilipp Oeser
We define Lossless as CRF 0 (which is usually the best quality and is working fine with other codecs afaict), but since WebM only allows for CRF values between 2-32 and actually has a dedicated "lossless" mode, I suggest using that (it produces large files though, so double-checking would be welcome). https://trac.ffmpeg.org/wiki/Encode/VP9#LosslessVP9 Maniphest Tasks: T74443 Differential Revision: https://developer.blender.org/D7800
2020-03-19Cleanup: `make format` after SortedIncludes changeDalai Felinto
2020-03-13Cleanup: pass const args (mostly Scene & RenderData)Campbell Barton
2020-02-10Cleanup/refactor: Rename `BKE_library` files to `BKE_lib`.Bastien Montagne
Note that `BKE_library.h`/`library.c` were renamed to `BKE_lib_id.h`/`lib_id.c` to avoid having a too generic name here. Part of T72604.
2019-08-01FFmpeg pixel format conversion improvementsSybren A. Stüvel
FFmpeg expects Blender to feed it pixels in the output pixel format. If the output pixel format is different than Blender's RGBA, a conversion is needed (via FFmpeg's `sws_scale()` function). There were a few issues with this conversion (and surrounding code) that are fixed in this commit: - When conversion was necessary a temporary buffer was allocated and deallocated for every frame. This is now allocated once and re-used. - Copying data to the buffer was done byte-for-byte. On little-endian machines it is now done line-by-line using `memcpy` for a little speedup. - The decision whether pixel format conversion is necessary is now correctly done based on the pixel format Blender is actually using. - The pixel format of the buffer sent to FFmpeg is no longer hard-coded incorrectly to a fixed pixel format, but uses the actual output pixel format. This is fixes T53058 properly, making RGB QTRLE export possible. - I added some comments to make it clear which pixel format is referred to (either Blender's internal format or the FFmpeg output format). Combined these improvements not only correct a bug (T53058) but also results in approximately 5% speed improvement (tested with a 117-frame shot from Spring, loaded as PNGs in the VSE, encoding to h.264 with preset 'realtime'). Reviewed By: brecht, sergey Differential Revision: https://developer.blender.org/D5174
2019-07-31Fix Visual Studio compatibility in writeffmpeg.cSybren A. Stüvel
This fixes an incompatibility with Visual Studio 2019 introduced in 631d5026c7bb34320c5d9b60afa5bc44b40fc5e4. It is likely caused by using `# ifdef` inside the use of the `ELEM()` macro.
2019-07-31FFmpeg: Added writing of WebM containersSybren A. Stüvel
This commit adds support for the WebM container. Previously we only supported the WebM/VP9 video codec, but still required that it was stored in a Matroska, MP4, or other compatible container format. Reviewed By: brecht Differential Revision: https://developer.blender.org/D5156
2019-07-31FFmpeg: Added support for writing alpha values in WebM/VP9 videoSybren A. Stüvel
The VP9 video codec supports writing alpha values; now this is available in Blender too. Reviewed By: brecht Differential Revision: https://developer.blender.org/D5156
2019-07-31Cleanup: Simplification of `BKE_ffmpeg_alpha_channel_is_supported()`Sybren A. Stüvel
Simplified `BKE_ffmpeg_alpha_channel_is_supported()` to use `ELEM()` instead of a row consecutive `if`-statements. No functional changes. Reviewed By: brecht Differential Revision: https://developer.blender.org/D5156
2019-07-02Fix T53058: Crash when rendering to Quicktime RLE codecSybren A. Stüvel
The root cause seems to be an assumption in [generate_video_frame()](https://developer.blender.org/diffusion/B/browse/master/source/blender/blenkernel/intern/writeffmpeg.c) that we're always using 4 bytes per pixel. This is not true when using QTRLE in RGB mode, because that uses the RGB24 pixel format (so 3 bytes per pixel). Just updating the `linesize` property doesn't fix it though, but just creates a crash somewhere else. This at least fixes the crash by always forcing RGBA to be written, even when the user selects RGB.
2019-06-30Fixed compiler warningSybren A. Stüvel
`(1L << 31)` can cause an integer overflow on 32-bit systems, `(1UL << 31)` won't. Fixed as per LazyDodo's suggestion in https://developer.blender.org/rB956cb4f403dd3a6ddb379202dc1f2770b9820073#238718