Commit Graph

285 Commits

Author SHA1 Message Date
Jonathan Thomas
0fcdcdb326 Removing debug code 2025-06-06 16:11:18 -05:00
Jonathan Thomas
7ee4643a60 Splitting FF_NUM_PROCESSORS into a VIDEO and AUDIO constant. Also limiting VIDEO encoders to 16 threads and audio encoders to 2 threads. 2025-06-06 15:28:28 -05:00
Jonathan Thomas
5e4bc364cb Remove per-thread scalers; use single persistent frames and SwsContext for video scaling. Total improvement of 8-9% when testing h.264 encoding @ 720p. 2025-06-05 19:38:15 -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
c0c7da749d Set libx265 hvc1 tag (for Apple playback compatibility). Apparently, we can't just set this on the mux_dict, but rather set the tag on the video codec (libx265). 2025-03-10 14:46:00 -05:00
Jonathan Thomas
8c25bebfa2 Copying mux flags into header if non-null (which should only be true for moov fast start options and h.265 hvc1 tags) 2025-03-09 20:02:39 -05:00
Jonathan Thomas
10145df409 Adding hvc1 tag for apple playback support of h.265 files. Also fixing a regression in the is_mp4/is_mov logic. 2025-03-09 19:21:29 -05:00
Jonathan Thomas
5be0f4a32b Removing an unneeded avcodec encoder flush, which was breaking many encoders on newer versions of FFMPEG. This would result in failed hardware acceleration and videos with no video frames. 2024-09-06 17:41:49 -05:00
Jonathan Thomas
5305e77586 Update FFmpegWriter.cpp
attempt #3 on GitHub editor, build error fix
2024-05-10 18:07:48 -05:00
Jonathan Thomas
a188a4d378 Update FFmpegWriter.cpp
2nd Attempt to fix this in the GitHub file editor, lol
2024-05-10 17:51:16 -05:00
Jonathan Thomas
eed38ba706 Update FFmpegWriter.cpp
Moving variable init and fixing build error
2024-05-10 17:43:08 -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
d87e9e49c8 Un-reverting previous commit, removing queuing from FFmpegWriter for simplicity. Increasing margin on webm unit tests, when checking pixel color. 2024-02-10 20:28:47 -06:00
Jonathan Thomas
038dd175ec Reverting changes to FFmpegWriter to test unit tests on GitHub builder 2024-02-10 20:02:13 -06:00
Jonathan Thomas
9a66704ec3 Fixing a few regressions, writing audio trailer, crashes due to writing audio trailer, etc... 2023-10-08 19:56:02 -05:00
Jonathan Thomas
48f11e92f0 Remove queuing and spooling support from FFmpegWriter to reduce complexity. Most codecs handle the multi-tasking themselves, making this code mostly useless. 2023-07-18 18:21:57 -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
70e86ef044 Improved Profile Class (Helper methods, Sortable, Unit tests) (#895)
* Removing legacy profile property. Add new operators for Profile classes (for comparison). Also added new functions to generate different variations of the Profile data (key, short name, long name, long name w/description).

* Add empty constructor for Profile class, and new Profile unit tets

* Adding zero padding to profile Key function, for easier sorting: 01920x1080i2997_16:09

* Clear setfill flag after creating Key() output

* Updating example exe to load an *.osp project file via C++, which makes debugging complex broken projects much easier.

* - Add new unit test to FFmpegWriter to create an animated GIF and verify it can be wrapped with a FrameMapper (with no audio track)
- Improve FrameMapper to ignore missing audio data (i.e. when no audio samples present, don't try and find them or resample them)

* Fix some whitespace issues

* Fix inline documentation mistype

* Fixed missing reuse licensing on new example profile files

* Changing Profile::Key() format to exclude the : character, since Windows file names cannot contain that

* - Large memory leak fixed in FFmpegWriter when closing the video & audio contexts
- Reducing # of cached frames and rescalers to 1, since we no longer use OMP and this is unneeded - we need to refactor much of this code out eventually

* - Fixing whitespace issues
- Code clean-up / line wrapping / etc...
2023-02-02 16:29:38 -06:00
Frank Dana
08b4975600 Replace av_init_packet in FFmpeg 3.2+ (#784) 2022-03-16 23:58:06 -04:00
Frank Dana
6c546408ca src/FFmpegWriter.cpp: Fix indents 2022-03-13 20:00:43 -04:00
FeRD (Frank Dana)
2a93c0c3bf FFmpegWriter: Don't use AVPicture (gone in 5.0) 2022-02-24 10:34:41 -05:00
FeRD (Frank Dana)
eac566f81f FFmpegWriter: Don't force deprecated stream member 2022-02-24 07:55:03 -05:00
FeRD (Frank Dana)
93debab7c4 FFmpegWriter: Macro & member cleanup
- The `fmt` class member, which was of type AVFormat*, was really
  just an unnecessary copy of `(AVFormatContext*)oc->oformat`.
  But we were ASSIGNING into its members, which we were definitely
  not supposed to be doing. (And in recent FFmpegs, now that
  `AVFormat` has been `const`d, we can't.) It's gone; now we just
  use `oc->oformat` anywhere we used to access `fmt`.

- The preprocessor macro to allocate a new _stream_ was a mess of
  cross purposes: It did allocate a stream, but then it also
  allocated a new AvCodecCtx on newer FFmpeg releases. Worse (and
  always galling to me), it proceeded to assign to a variable
  that WASN'T passed in to the macro, just taking it on faith that
  it would only be used where that variable was defined. That's
  just... ugh. So I broke it apart into two steps (stream creation
  and context allocation), realized the stream creation code was
  the same for all ffmpeg versions and didn't need to be a macro
  at all, and now a 4-parameter, 6-line magical macro has been
  replaced with a simple, zero-side-effect one-liner.

- I also cleaned up the add_video_stream() code to be more like
  the add_audio_stream() code, since they were bad-different for
  no discernible reason.
2022-02-24 07:29:08 -05:00
FeRD (Frank Dana)
3b1d4102af FFmpegWriter: Format ZmqLogger calls, move headers 2022-01-12 11:02:52 -05:00
nick black
99034feb4e constify some AVCodecIDs, necessary for new ffmpeg
Signed-off-by: nick black <dankamongmen@gmail.com>
2021-11-22 00:09:08 -05:00