Commit Graph

400 Commits

Author SHA1 Message Date
Jonathan Thomas
c95fd837b6 Small improvement to caching sws scale context and reusing AVFrame objects. About 1.5% less CPU calls, and more even memory allocations (less spikey). 2025-06-04 17:18:23 -05:00
Jonathan Thomas
ea74c500a0 Merge pull request #1004 from OpenShot/360-spherical
360 spherical video metadata + projection effect
2025-05-23 22:22:07 -05:00
Jonathan Thomas
68b885ee77 Adding 32 bit alignment for simd into our AV_ALLOCATE_IMAGE macro, and some code cleanup 2025-05-23 18:35:03 -05:00
Jonathan Thomas
4983a45f74 Merge pull request #987 from ArmstrongCN/bugfix/ffmpeg
fix av_image_alloc alignment && check allocation error
2025-05-23 18:13:29 -05:00
Jonathan Thomas
7fb8308cc7 Adding spherical support to FFmpegWriter and FFmpegReader, so they can optionally write the correct side data for Spacial and equirectangular 360 videos. 2025-05-20 20:21:32 -05:00
Jonathan Thomas
c608ef6918 Hiding nb_side_data depreciation warnings for now (but I added a TODO for a reminder) 2025-03-11 23:12:39 -05:00
Jonathan Thomas
4abe4cdab0 Add new side data rotation detection, used by modern cell phone video. Save "rotate" metadata as the inverse of the rotation (to correct it). 2025-03-11 18:29:22 -05:00
Jonathan Thomas
63046c59f8 Fix GIF video_length and duration calculations, so we currently handle animated gifs and static gifs. 2025-03-01 22:05:27 -06:00
Armstrong
e9999adda9 fix av_image_alloc alignment && check allocation error 2025-01-24 16:26:40 +08:00
Jonathan Thomas
b89bc5f006 Adding in support for WAV channel layouts, that newer versions of FFMPEG no longer attempt to guess. Support for MONO and STEREO layouts added back in. 2024-09-06 17:40:52 -05:00
Robert-André Mauchin
08d7f3354b Add compatibility with FFMPEG 7.0
channel_layout has been replaced with ch_layout

Fix #953
2024-05-09 12:56:48 +02:00
Jonathan Thomas
9aa3713651 Large refactor of FFmpegReader ProcessAudioPacket to allow FFmpeg to convert sample values into floats (AV_SAMPLE_FMT_FLTP), each channel in it's own data buffer, which makes it easy to pass to Frame::AddAudio. 2023-06-27 18:12:59 -05:00
Jonathan Thomas
fe281509a4 Fix webm packet reading, to correctly retry packets. Sometimes we must send more packets before receiving decoded data, and sometimes we need to receive more decoded data before sending more packets. We had a logic error in this code. 2023-04-14 18:46:49 -05:00
Jonathan Thomas
78a194c368 Fixing long running memory leak related to AVFRAME init in FFmpegReader.cpp 2023-03-20 16:06:45 -05:00
Jonathan Thomas
09ce05bbf2 Many improvements for smooth audio playback when 'time' keyframes are used for time remapping.
- Added new Frame::ReverseAudio() helper method - for time keyframe support playing backwards audio
- Fixed math rounding error on time keyframe Resampler, to use the rounded source samples value
- Removed some unused args and Frame audio methods
- Reset FrameMapper resample context when non-adjacent frames are requested
- Correctly reverse Frame audio if a time keyframe is present, and reversing audio
- Rewrite Keyframe::IsIncreasing() function, to give accurate direction of time keyframes at any index (special logic to support first and last indexes)
- Fixed Keyframe unit tests - since logic has changed a bit
- Improved time mapping unit tests
- Replace many c-style casts with static_cast
- Added new sine.wav test file
2023-03-10 01:15:14 -06:00
Jonathan Thomas
52a9e3be5d - Clip reader init should consider paths with a % to use FFmpegReader by default (i.e. image sequences)
- FFmpegReader info struct should not be initialized during Open() after it is initially populated - so our SetJson() method can properly override it's values
- FrameMapper Json() method should include it's mapped Reader JSON - even though it is not yet possible to read it back in yet
- New unit tests for Timeline ApplyJsonDiff, and verification that we can override FFmpegReader info struct (i.e. updating FPS, time bases, etc...)
- Some whitespace fixes
2023-02-13 16:42:21 -06:00
Jonathan Thomas
2f08ac0c1c Allow waveform generation to happen before Clip effects are processed. Also, allow the Caption effect to add image data (i.e. waveform graphic) and allow Clip to detect that image to output it correctly. The result of all this: audio-only files now support the Caption effect, on top of the generated waveform image. Lastly, generated waveforms should use the entire Timeline size - and not a pre-determined 720x480 size. 2023-02-10 15:16:56 -06:00
Jonathan Thomas
520446c5e4 Fix whitespace 2022-11-26 22:47:28 -06:00
Jonathan Thomas
d8ff69c6ed Fix a huge regression which invokes the avcodec_open() method twice for every call to FFmpegReader::Open(), leaving many threads running and never joined/closed. Also, adding some additional error message when attempting to call avcodec_open(). 2022-11-26 22:47:04 -06:00
Jonathan Thomas
5a380485da Fixing whitespace 2022-11-23 14:01:43 -06:00
Jonathan Thomas
1bd1fdcb2a Silence audio data if repeating last frame in FFmpegReader (to prevent audio glitch for files with invalid durations) 2022-11-23 13:56:57 -06:00
Jonathan Thomas
70db06947d Prevent seeking past end of stream, which causes a huge # of Seeks once EOF is reached, if we try and request frame #s too large for the file 2022-11-23 12:45:10 -06:00
Jonathan Thomas
fdcf9b9118 Renaming variable in FFmpegReader to make more sense 2022-11-16 15:17:03 -06:00
Jonathan Thomas
58dc99d1f9 Fixing whitespacae 2022-11-15 14:52:13 -06:00
Jonathan Thomas
e9aa87c3f3 Experimental refactor around sending/receiving packets with the decoder in FFmpegReader. 2022-11-15 10:57:33 -06:00