116 Commits

Author SHA1 Message Date
kc5nra
34b95eff8a obs-ffmpeg: Sychronize logging on log context
Different logging can occur from different contexts.
This adds isolation for each context passed to the
AV log.
2015-08-14 07:53:52 -07:00
John Bradley
6e69b0f4f0 obs-ffmpeg: Move log callback up to plugin scope 2015-08-14 07:53:51 -07:00
John Bradley
d04fbd7549 obs-ffmpeg: Log source info on update/create
Adds a log message whenever the source is created or updated
containing all the properties set to help debugging remote
users' problems.
2015-08-14 07:53:50 -07:00
John Bradley
78d5240e18 obs-ffmpeg: Add more informative logging to source 2015-08-14 07:53:48 -07:00
John Bradley
207203d104 obs-ffmpeg: Normalize ffmpeg source argument name 2015-08-14 07:53:47 -07:00
John Bradley
59482ec29b obs-ffmpeg: Normalize video frame method arguments 2015-08-14 07:53:46 -07:00
kc5nra
34cc2438c1 obs-ffmpeg: Output ffmpeg messages line by line 2015-08-14 07:53:45 -07:00
jp9000
c87d3b1f12 cmake: Rename FindFFMpeg to FindFFmpeg
This was sort of driving me crazy: The 'm' in FFmpeg isn't supposed to
be capitalized.
2015-07-18 16:32:26 -07:00
jp9000
50b47a6861 obs-outputs: Use actual audio encoder sample rate 2015-07-09 10:43:32 -07:00
dodgepong
fb679bdd02 Add latest translations from CrowdIn 2015-07-08 14:56:07 -04:00
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