Commit Graph

255 Commits (40f8d4cfb2fada75bd4ec35a6743f92ef5a961bb)

Author SHA1 Message Date
comex c54cc0bf5b obs-ffmpeg: fill in more fields on audio frames
After you call av_frame_alloc(), ffmpeg expects you to fill in certain
fields on the frame, depending on whether it's an audio or video frame.
obs-ffmpeg did this in the two places where it allocates video frames,
but not where it allocates audio frames.  On my system, using trunk
ffmpeg and the Opus codec, this causes OBS to crash while calling
avcodec_send_frame, ultimately because av_frame_copy fails due to
'dst->format < 0' (as 'format' stays at the default of -1), causing a
null pointer to be added to a buffer queue, which later gets
dereferenced.

Oddly, the fields in question can just be copied directly from
corresponding fields in the AVCodecContext, but I don't see any ffmpeg
API to automatically copy all relevant fields, and all the examples I've
seen do it by hand.  So this patch does the same.
2018-04-18 13:13:48 -07:00
Gol-D-Ace 88282c168c Update translations from Crowdin 2018-03-15 09:00:28 +01:00
Gol-D-Ace 7337b7ffb8 obs-ffmpeg: Fix locale typo 2018-03-01 22:44:43 +01:00
jp9000 aa58b9cf5f obs-ffmpeg: Use FFmpeg's "fast" AAC encoder by default
FFmpeg has recently made their "fast" AAC encoder the default, which
uses less CPU and sounds better at common bitrates.
2018-02-26 00:11:30 -08:00
jp9000 a89470d2ea obs-ffmpeg: Remove cutoff hack for AAC encoder
The cutoff hack was added many, many years ago as recommended by
Konverter.  Since then, there has been much work on the AAC encoder, so
this hack should no longer be necessary.
2018-02-25 23:50:09 -08:00
Exeldro 277b664001 obs-ffmpeg: Add speed percentage option
(Note: This commit also modifies the deps/media-playback module.)

Allows modifying the speed of local file playback.

Closes jp9000/obs-studio#1091
2018-02-15 15:18:13 -08:00
jp9000 dc0363d3e8 deps/media-playback: Use a struct for media init data
Instead of using countless parameters for the media initialization data,
use a structure.
2018-02-15 13:32:35 -08:00
pkviet 645d6ae8dd libobs/media-io: Change speaker layout to match FFmpeg aac.
(This commit also modifies the obs-ffmpeg module)

The default channel layouts from aac spec are implemented in FFmpeg
native aac encoder as follows:

    AV_CH_LAYOUT_MONO,
    AV_CH_LAYOUT_STEREO,
    AV_CH_LAYOUT_SURROUND,
    AV_CH_LAYOUT_4POINT0,
    AV_CH_LAYOUT_5POINT0_BACK,
    AV_CH_LAYOUT_5POINT1_BACK,
    AV_CH_LAYOUT_7POINT1,

The correspondence of speaker layouts to AV_CH_LAYOUT from FFmpeg is
changed to reflect the previous table.

Although FFmpeg native aac encoder can now encode all the layouts listed
in avutil channel_layout.h (on master), there might be issues with older
FFmpeg binaries.

Note that 2.1 speaker layout will be encoded as AV_CH_LAYOUT_SURROUND
(FL FR FC) because it is not listed as the default layout for three
channels.

This just means some optimizations for LFE channel will not be used by
the encoder which will treat it as an SCE (single channel element).

Closes jp9000/obs-studio#1182
2018-02-06 06:14:24 -08:00
Gol-D-Ace ae22886f67 Update translations from Crowdin 2018-01-22 04:55:52 +01:00
jp9000 6774bbdb83 obs-ffmpeg: Remove NVENC detection code for now
The reason this code is being reverted/removed is because this code is a
risk to startup stability.  This check will be added again in the
future, however this code needs to be executed from a secondary piped
process instead of directly in the process to reduce risk of
driver/hardware issues impacting program startup.  The same needs to be
accomplished for the AMF plugin as well.
2018-01-20 05:31:58 -08:00
jp9000 f5c3af1bda obs-ffmpeg: Fix signed mismatch warning 2018-01-19 16:19:10 -08:00
jp9000 655288baec obs-ffmpeg: Do not return last replay path if currently muxing 2018-01-18 08:54:43 -08:00
jp9000 8fc486339c obs-ffmpeg: Add proc to get last replay buffer
Allows getting the path of the last replay buffer saved via the
procedure handler of the FFmpeg muxer output.
2018-01-18 05:34:26 -08:00
Lucian Poston ff45b7b119 obs-ffmpeg: Call av_register_all before nvenc check
Closes jp9000/obs-studio#1157
2018-01-18 01:36:46 -08:00
jp9000 653d3ceb33 obs-ffmpeg: Don't try to detect NVENC on mac 2018-01-18 01:36:46 -08:00
Michel 054d607c2d obs-ffmpeg: Improve NVENC detection
This improves detection by performing an actual check on encoder
capability directly with the NVENC/CUDA libraries.
2018-01-18 01:35:45 -08:00
jp9000 17560bf86a Revert "obs-ffmpeg: Improve NVENC detection"
This reverts commit 94b5982216.

Reverting this commit because it had some negative side effects, such as
adding 500 milliseconds to the startup time.  NVENC detection should
really be done through its proper API, and not via creating an encoder
on startup.
2018-01-12 05:35:01 -08:00
Jim 05a8969439
Merge pull request #1120 from pkviet/ffmpeg
obs-ffmpeg: Fix ffmpeg output recording in x264
2018-01-05 16:47:07 -08:00
pkviet 67e48ecc2c libobs/media-io: Replace quad with 4.0
(also obs, deps/media-playback, libobs/audio-monitoring, decklink,
linux-alsa, linux-pulseaudio, mac-capture, obs-ffmpeg, win-dshow,
win-wasapi)

Default channel layout for 4 channels is 4.0 in FFmpeg.
Replacing quad with 4.0 will improve compatibility since FFmpeg has
better support of its default channel layouts.
2018-01-05 09:48:52 -08:00
pkviet fb580535c9 libobs/media-io: Clean surround API
(also modifies obs-ffmpeg, audio-monitoring, win-wasapi, decklink,
obs-outputs)

Removes speaker layouts which are not exposed in UI.  The speaker
layouts selectable by users in the UI are the most common ones.  It is
not necessary to keep other layouts.  (This basically removes
5POINT1_SURROUND, 7POINT1_SURROUND, SURROUND =3.0).
2018-01-05 09:47:59 -08:00
pkviet 520a91323b obs-ffmpeg: Fix ffmpeg output recording in x264
Fixes ticket 1070.
See also
https://obsproject.com/forum/threads/ffmpeg-recording.77378/#post-330473
(related bugs).
The ffmpeg constant AVFMT_RAWPICTURE was deprecated in october 2015
and marked for removal at avformat major bump to version 58
(ffmpeg commit 34ed5c2 , oct 12, 2015).
The bump occured with commit 69b5ce6 (oct21, 2017).
The constant was subsequently removed (commit 693a11b, oct 26 2017).
It was removed from obs-studio with commit d670d7b (from me).
But the code block which was executed with this constant was not
removed, causing issues with ffmpeg output.
The commit fixes the issue for old ffmpeg builds as well as new ones.
The constant is reintegrated for avformat major version < 58 and removed
for version >= 58 (along with its accompanying code).
Thanks to J Lowe for help in solving the bug.
(tested on win 10, macos 10.13, ubuntu 17.10 with ffmpeg head & ffmpeg
3.4.1)
2017-12-21 23:28:35 +01:00
jp9000 0497095f97 Fix a number of GCC warnings 2017-12-06 16:42:45 -08:00
jp9000 530266917d obs-ffmpeg: Use correct function with older FFmpeg vers.
When this was being fixed up, the incorrect function name was used --
however it still compiled because the author was using the newer FFmpeg
version at the time.
2017-12-06 10:10:03 -08:00
jp9000 0d6204c8af Fix a number of MSVC warnings
Fixes a number of warnings with all modules
2017-12-05 13:53:44 -08:00
Michel 94b5982216 obs-ffmpeg: Improve NVENC detection
Certain NVIDIA GPUs don't support NVENC, but ship with the NVENC
library, causing OBS to mistakenly think that NVENC is available when it
actually isn't.

Closes jp9000/obs-studio#1087
2017-12-02 08:08:52 -08:00
pkviet bbac3280c1 libobs: Add surround sound audio support
(This commit also modifies the following modules: UI,
deps/media-playback, coreaudio-encoder, decklink, linux-alsa,
linux-pulseaudio, mac-capture, obs-ffmpeg, obs-filters, obs-libfdk,
obs-outputs, win-dshow, and win-wasapi)

Adds surround sound audio support to the core, core plugins, and user
interface.

Compatible streaming services: Twitch, FB 360 live
Compatible protocols: rtmp / mpeg-ts tcp udp
Compatible file formats: mkv mp4 ts  (others untested)
Compatible codecs: ffmpeg aac, fdk_aac, CoreAudio aac,
		   opus, vorbis, pcm (others untested).
Tested streaming servers: wowza, nginx
	 HLS, mpeg-dash : surround passthrough
Html5 players tested with live surround:
	 videojs, mediaelement, viblast (hls+dash), hls.js
Decklink: on win32, swap channels order for 5.1 7.1
         (due to different channel mapping on wav, mpeg, ffmpeg)
Audio filters: surround working.
Monitoring: surround working (win macOs linux (pulse-audio)).
VST:	 stereo plugins keep in general only the first two channels.
	 surround plugins should work (e.g. mcfx does).
OS: win, macOs, linux (alsa, pulse-audio).
Misc: larger audio bitrates unlocked to accommodate more channels
NB: mf-aac only supports mono and stereo + 5.1 on win 10
         (not implemented due to lack of usefulness)

Closes jp9000/obs-studio#968
2017-11-26 03:41:53 -08:00
jp9000 edf34fdf25 obs-ffmpeg: Log bad muxer settings with FFmpeg output 2017-11-24 21:18:57 -08:00
jp9000 ee63fc69ac obs-ffmpeg: Use muxer settings with AVIOContext
In the FFmpeg output, it was not passing the muxer settings to the
AVIOContext, so some settings would not be properly passed to protocols.
2017-11-24 21:18:52 -08:00
pkviet d670d7badb libobs: Fix FFmpeg constants
(This commit also modifies the deps/media-playback, obs-ffmpeg, and
win-dshow modules)

More fixes due to ffmpeg renaming some constants and deprecating
AVFMT_RAWPICTURE and AV_PIX_FMT_VDA_VLD.
Latter replaced by AV_PIX_FMT_VIDEOTOOLBOX per ffmpeg dev advice.

Closes jp9000/obs-studio#1061
2017-11-16 21:38:37 -08:00
Richard Stanway 95f20c84ba obs-ffmpeg: Use new ffmpeg constants 2017-10-26 19:17:53 +02:00
jp9000 7bd06e7f26 Update translations from Crowdin 2017-10-17 05:39:22 -07:00
jp9000 c9182a9878 obs-ffmpeg: Fix potential seek issues with media source
(This commit also modifies deps/media-playback)

Before, the media-playback library would detect whether something was
seekable by checking the filename for "://", which is unideal because
there are other cases where targets may not be seekable.  So instead, an
explicit "seekable" property (off by default) is now in place in the
media source when not in "local file" mode.  Seeking will only be
enabled if local file mode is on, or if "seekable" is explicitly checked
by the user.

Closes jp9000/obs-studio#1022
2017-09-17 05:55:56 -07:00
chinasarft 1ef4de7ce3 obs-ffmpeg: Don't mark to destroy media unless valid
Closes jp9000/obs-studio#1021
2017-09-15 05:51:52 -07:00
Gol-D-Ace 8d8c2e5a22 Update translations from Crowdin 2017-08-10 16:07:40 +02:00
derrod 8b3921ffbf obs-ffmpeg: Add proc handler for getting number of frames in video
Allows getting (approximate) number of frames in a media file.
2017-08-08 10:06:56 +02:00
Richard Stanway ca5f123030
obs-ffmpeg: Improved output error handling
Checks the output path is writable and checks for failure to start the
ffmpeg-mux subprocess.
2017-08-07 00:32:49 +02:00
jp9000 fa611dcd76 obs-ffmpeg: Add Opus audio encoder 2017-08-01 02:14:58 -07:00
jp9000 d2ffd0fdd2 obs-ffmpeg: Ensure sample rate is supported in audio encoder
Ensures that the sample rate is supported in the audio encoders, and if
not, then make it automatically resample to the closest sample rate.
2017-07-31 14:51:21 -07:00
jp9000 0089d379b0 obs-ffmpeg: Make FFmpeg audio encoder abstractable
Abstracts the FFmpeg audio encoder to allow other codecs to use the same
code, and makes the AAC encoder derived from it.
2017-07-31 14:48:20 -07:00
jp9000 58c4f0ac91 obs-ffmpeg: Rename obs-ffmpeg-aac.c file
Renames obs-ffmpeg-aac.c to obs-ffmpeg-audio-encoders.c due to the fact
that it can be abstracted for multiple audio encoders.
2017-07-31 14:29:50 -07:00
jp9000 cffbdd6408 obs-ffmpeg: Add proc handler function to get media duration
Allows getting the duration of a video via the proc handler of the
source.
2017-07-19 16:23:06 -07:00
Jim cfe77fdaae Merge pull request #938 from admshao/incompatible-pointer-types
plugins: Clear warnings about -Wincompatible-pointer-types
2017-07-01 10:37:32 -07:00
Shaolin e5756a922a libobs/plugins/UI: Suppress unused variables warnings
Closes jp9000/obs-studio#937
2017-06-27 21:55:37 -07:00
jp9000 d295ad3ed3 obs-ffmpeg: Remove "Buffering (MS)" property
There's no need to display this property at the moment, the default
amount is more than sufficient for most cases.  That and most people
wouldn't know what to do with it anyway.
2017-06-22 00:58:45 -07:00
Richard Stanway cef0689a36
ffmpeg-mux: Set error mode to SEM_FAILCRITICALERRORS
This prevents spurious dialog boxes appearing, such as "No disk is in the
drive" if the application attempts to access an invalid drive.
2017-06-21 17:41:08 +02:00
jp9000 b787c796cd obs-ffmpeg: Do not precache if set to close when inactive
In the media source, do not pre-cache frames if the source is set to
close the file when inactive because that setting is designed to allow
the file to be replaced by the user.  If it's replaced, it can
unintentionally keep the old precache frame, playing the frame from the
older video when it starts up.
2017-06-19 22:58:01 -07:00
jp9000 054148a0af obs-ffmpeg: Don't preload media frames if set to pause on end
Preloading is designed to overwrite the current internal render texture
of the source so it'll be ready to play the first frame right when the
source is first displayed.

However, When the media source is set to pause on the last frame, it
keeps that current render texture visible, so preloading it with the
first frame will essentially overwrite the current render, causing it to
inadvertently show and pause on the first frame rather than the last
frame.  So instead, just disable preloading when the user has it set to
pause on the last frame.
2017-06-14 08:30:44 -07:00
Shaolin cfcb2f4f39 plugins: Clear warnings about -Wincompatible-pointer-types
Signed-off-by: Shaolin <admshao@gmail.com>
2017-06-01 05:25:55 -03:00
jp9000 892a6548e7 obs-ffmpeg: Add network buffering property
(Note: This commit also modifies deps/media-playback)

Allows buffering network-based media sources where supported.  Default
is two megabytes of buffering.
2017-05-29 19:30:13 -07:00
jp9000 1738adf021 Revert "obs-ffmpeg/nvenc: Remove "default" preset"
This reverts commit d1343dc064.

Apparently people are having issues caused by this specific commit.
Going to temporarily revert for the time being.
2017-05-21 02:54:41 -07:00