Commit Graph

106 Commits (2dfed30509e00e4370036622dc352d8fb31a2d85)

Author SHA1 Message Date
jp9000 5f75993882 obs-ffmpeg: Improve AAC logging
Adds a separator and uses better logging techniques
2015-07-06 17:03:40 -07:00
jp9000 d1e9b9d66a obs-ffmpeg: Fix potential integer overflows
This particularly affected audio encoding, audio encoding previously
would count samples and use it to create an encoding timestamp, but
because I was using a standard integer (which is 32bit by default on
x86), it would max out at about 0x7FFFFFFF samples, which is about 12
hours of samples at 48000 sample rate.  After that, it would start going
into negative territory (overflowing).  By changing it to int64_t, it
will make it so that audio at 48000 samples per second would only be
able to overflow after about..  6.09 million years.  In other words,
this should fix the issue for good.
2015-07-03 17:18:08 -07:00
jp9000 9048743ebe obs-ffmpeg: Add ffmpeg muxer
In addition to the flv file format, this allows the ability to save to
container formats such as mp4, ts, mkv, and any other containers that
support the current codecs being used.

It pipes the encoded data to the ffmpeg-mux process, which then safely
muxes the file from the encoded data.  If the main program unexpectedly
terminates, the ffmpeg-mux piped program will safely close the file and
write trailer data, preventing file corruption.
2015-06-21 22:34:49 -07:00
jp9000 33a040b025 obs-ffmpeg: Add ffmpeg muxer pipe program 2015-06-21 22:34:49 -07:00
jp9000 4d75c888a3 obs-ffmpeg: Use timestamps from video/audio frames
Instead of using system timestamps for playback, use the timestamps
directly from the video/audio data to ensure all the data is synced up
using the obs_source back-end.

I think the original misconception when this was written was that OBS
would not handle timestamp resets/loops, which isn't the case; it will
actually handle all timestamp resets and abnormalities.  It's always
best to use the obs_source back-end for all playback and syncing.
2015-06-10 09:44:25 -07:00
dodgepong d0fbe3b382 Add latest translations from CrowdIn 2015-05-08 17:10:39 -04:00
kc5nra 5b97cfbbdd obs-ffmpeg: Only set codec ids if format non-null
In the settings if you select default container then the
format becomes null.  If null then audio/video codec ids should
not be set on the output format as they will both be
AV_CODEC_ID_NONE causing a context with no streams specified
to be created (error).
2015-04-26 17:31:21 -05:00
jp9000 c33384fe7a obs-ffmpeg: Add support for YUV 4:4:4
Add support for YUV 4:4:4 output (if supported by the encoder currently
in use by FFmpeg)
2015-04-18 00:03:14 -07:00
jp9000 4d002f588b (API Change) Remove encoder callback boilerplate
API Changed (in struct obs_encoder_info):
----------------------------------------
bool (*get_audio_info)(void *data, struct audio_convert_info *info);
bool (*get_video_info)(void *data, struct video_scale_info *info);

To:
----------------------------------------
void (*get_audio_info)(void *data, struct audio_convert_info *info);
void (*get_video_info)(void *data, struct video_scale_info *info);

The encoder video/audio information callbacks no longer need to manually
query the libobs video/audio information, that information is now passed
via the parameter, which the callbacks can modify.

The refactor that reduces boilerplate in the encoder video/audio
information callbacks also removes the need for their return values, so
change the return types to void.
2015-04-17 20:17:43 -07:00
jp9000 908a165d62 Add planar YUV 4:4:4 format support
Adds the ability to natively output with planar YUV 4:4:4.
2015-04-17 20:16:40 -07:00
vividnightmare f29f286402 obs-ffmpeg: Only set x264 opts if actually x264
Check the actual name of the codec before applying an x264-specific
preset so we don't encounter an "Invalid argument" error when using
other h264 encoders in FFmpeg (such as NVEnc).

Closes jp9000/obs-studio#412
2015-04-11 06:06:04 -07:00
Ethan Lee fd4f2e29aa Buildfix for older FFmpeg versions (F20 RPMFusion) 2015-04-01 06:50:22 -04:00
kc5nra f04be51947 obs-ffmpeg: Set channel layout to avoid warning 2015-03-30 17:58:44 -05:00
kc5nra aa82340a1e obs-ffmpeg: Set stream time_base to avoid warnings 2015-03-30 17:58:44 -05:00
kc5nra c53f8cbed8 obs-ffmpeg: Add format and codec id support
Allow specification of specific codec ids and container
format to muxing.
2015-03-30 17:58:37 -05:00
John Bradley 4c570826c2 obs-ffmpeg: Workaround for a64 encoder bug
the Commodore A64 codecs seem to deref the video frame
too many times causing a crash.  For now just skip if this
codec.
2015-03-30 17:30:38 -05:00
kc5nra f128283655 obs-ffmpeg: Fix outputs without both video/audio
Fixes a crash in formats that don't support both video and audio
streams.
2015-03-30 17:30:38 -05:00
John Bradley fc596f6141 obs-ffmpeg: Fix spurious bad channel layout
Some formats (like WMV) would send out audio packets that
had channels set but did not specify a channel layout.
Solution is to no longer rely on channel layout to get the
channels and just get the channel count directly off the
FFmpeg audio frame.
2015-03-30 10:59:59 -05:00
dodgepong a04548070c UI: Add latest translations from CrowdIn 2015-03-25 20:51:25 -04:00
kc5nra 946b9d01e3 obs-ffmpeg: Clearer meaning for ClearMediaOnEnd 2015-03-24 07:25:57 -05:00
kc5nra dd2d6494a1 obs-ffmpeg: Add clear on media end option
Clears source video when the media stream ends.
2015-03-24 00:21:24 -05:00
kc5nra c7ad555eae obs-ffmpeg: Handle null frames in frame callbacks
This is in preparation of an API change that will send null
frames to signal the end of the media being played.
2015-03-24 00:16:35 -05:00
kc5nra b091b03291 obs-ffmpeg: Split definition and assignment 2015-03-24 00:12:10 -05:00
kc5nra 54baa1a369 obs-ffmpeg: Change from sws_* cacheing to our own
Since sws_getCachedContext possibly logs a message every
time it is used (depending on the input), use our own caching
logic to minimize log spam.
2015-03-23 22:14:42 -05:00
John Bradley d69f03c6a5 obs-ffmpeg: Use deferred update flag for properties 2015-03-19 16:02:24 -05:00
John Bradley c539c16ecc obs-ffmpeg: Instead of failing with unsupported CS, use default 2015-03-19 14:40:24 -05:00
John Bradley 52aae96f74 obs-ffmpeg: Add alias of CS601 support 2015-03-19 14:40:24 -05:00
John Bradley 17f8e3c58b obs-ffmpeg: Add frame drop controls to the ffmpeg source UI 2015-03-19 14:40:24 -05:00
jp9000 9832a760b8 (API Change) Always use planar float audio output
Core API functions changed:
-----------------------------
EXPORT bool obs_reset_audio(struct audio_output_info *aoi);
EXPORT bool obs_get_audio_info(struct audio_output_info *aoi);

To:
-----------------------------
EXPORT bool obs_reset_audio(const struct obs_audio_info *oai);
EXPORT bool obs_get_audio_info(struct obs_audio_info *oai);

Core structure added:
-----------------------------
struct obs_audio_info {
	uint32_t            samples_per_sec;
	enum speaker_layout speakers;
	uint64_t            buffer_ms;
};

Non-interleaved (planar) floating point output is standard with audio
filtering, so to prevent audio filters from having to worry about
different audio format implementations and for the sake consistency
between user interfaces, make it so that audio is always set to
non-interleaved floating point output.
2015-03-12 22:22:02 -07:00
John Bradley f23d958122 obs-ffmpeg: Cache picture buffer in the same way as sws context 2015-03-10 14:37:28 -05:00
John Bradley baea0f583a obs-ffmpeg: Remove extra curly braces 2015-03-10 14:34:37 -05:00
John Bradley a73c15ae16 obs-ffmpeg: Fix bug where update_sws_context result not checked 2015-03-10 14:33:21 -05:00
John Bradley e13bb8f479 obs-ffmpeg: Cache swscale context during frame callback
Some codecs don't report the correct dimensions until the first
frame is rendered.
2015-03-10 12:53:17 -05:00
John Bradley 0e944735e0 obs-ffmpeg: Fix error fetching properties from wrong pointer 2015-03-10 12:25:24 -05:00
John Bradley 2fc6c4d725 obs-ffmpeg: Add FFMpeg input source 2015-03-09 21:22:32 -05:00
John Bradley 8a32345071 obs-ffmpeg: Add FFmpeg format -> obs format func 2015-03-09 21:22:32 -05:00
dodgepong eb918d01b4 Add latest translations from CrowdIn 2015-02-09 19:26:17 -05:00
martell b8055ed944 obs-ffmpeg: avoid w32-pthreads for mingw-w64
mingw-w64 provides its own pthreads library
2015-02-09 03:41:51 -08:00
jp9000 d3f92ca5d6 obs-ffmpeg: Make FFmpeg a usable output
This makes FFmpeg usable as an output, and removes or changes most of
the code that was originally intended for testing purposes.

Changes the settings for the FFmpeg output to the following:
* url:             Sets the output URL or file path
* video_bitrate:   Sets the video bitrate
* audio_bitrate:   Sets the audio bitrate
* video_encoder:   Sets the video encoder (by name, blank for default)
* audio_encoder:   Sets the audio encoder (by name, blank for default)
* video_settings:  Sets custom video encoder FFmpeg settings
* audio_settings:  Sets custom audio encoder FFmpeg settings
* scale_width:     Image scale width (0 if none)
* scale_height:    Image scale height (0 if none)

The reason why scale_width and scale_height are provided is because it
may internally convert formats, and it may be a bit more optimal to use
that scaler instead of the pre-output scaler just in case it already has
to convert formats internally anyway (though you can do it either way
you wish).

Video format handling has also changed; it will now attempt to use the
closest format to the current format if available for a given video
codec.
2015-02-04 16:51:54 -08:00
jp9000 f091f062f0 obs-ffmpeg: Do not use CBR by default for FFmpeg
The FFmpeg output source will now mostly be used for file output, so
using CBR by default makes no real sense.
2015-02-04 16:51:53 -08:00
jp9000 ae862c16a6 obs-ffmpeg: If ffaac is used, change cutoff freq
If FFmpeg's experimental aac encoder is used, this changes the cutoff
frequency to better values in order to try to help make up for the
inherent lack of encoder quality a bit.  If FFmpeg is compiled to use
another encoder by default, these settings will not be applied.
2014-11-17 06:47:48 -08:00
dodgepong 17804ec12f Add latest translations from CrowdIn 2014-10-31 21:02:47 -04:00
Ben Torell 958b5c12de Latest translations from Crowdin 2014-10-11 18:47:35 -04:00
Palana 94a93abb2b (API Change) Pass data to get_properties when possible 2014-10-01 15:39:57 +02:00
BtbN 599febcb54 cmake: Replace FFMpeg modules with single module
Now using components instead of one find_package call per module
2014-09-27 09:41:13 -07:00
jp9000 c9df41c1e2 (API Change) Remove pointers from all typedefs
Typedef pointers are unsafe.  If you do:
typedef struct bla *bla_t;
then you cannot use it as a constant, such as: const bla_t, because
that constant will be to the pointer itself rather than to the
underlying data.  I admit this was a fundamental mistake that must
be corrected.

All typedefs that were pointer types will now have their pointers
removed from the type itself, and the pointers will be used when they
are actually used as variables/parameters/returns instead.

This does not break ABI though, which is pretty nice.
2014-09-25 21:48:11 -07:00
dodgepong a221fee3d2 Add latest translations from CrowdIn 2014-08-25 14:41:52 -07:00
BtbN 02725acdd4 Fix double invocation of install_obs_plugin in every single plugin 2014-08-19 14:24:59 +02:00
jp9000 f75a1ebf63 Plugins: Use new encoder/output size functions 2014-08-10 17:10:20 -07:00
jp9000 42a0925ce1 (API Change) media-io: Improve naming consistency
Renamed:                        To:
-----------------------------------------------------------
audio_output_blocksize          audio_output_get_block_size
audio_output_planes             audio_output_get_planes
audio_output_channels           audio_output_get_channels
audio_output_samplerate         audio_output_get_sample_rate
audio_output_getinfo            audio_output_get_info
audio_output_createline         audio_output_create_line
video_output_getinfo            video_output_get_info
video_gettime                   video_output_get_time
video_getframetime              video_output_get_frame_time
video_output_width              video_output_get_width
video_output_height             video_output_get_height
video_output_framerate          video_output_get_frame_rate
video_output_num_skipped_frames video_output_get_skipped_frames
video_output_total_frames       video_output_get_total_frames
2014-08-09 11:57:37 -07:00