diff --git a/contrib/src/ffmpeg/SHA512SUMS b/contrib/src/ffmpeg/SHA512SUMS
index 26127a40e0684edfac379cb0675bfa9f968bb4bb..d369d4450c61f52549322012ee79e6af84896bdd 100644
--- a/contrib/src/ffmpeg/SHA512SUMS
+++ b/contrib/src/ffmpeg/SHA512SUMS
@@ -1 +1 @@
-0c184e960a234cd08cbc3539885d00e83b17b28b2b49c1c55b8dc0f6d22f88183a48900285ac01e63a051bd12b003dd131f171f669b2051abeba8a3c3411975d  ffmpeg-n4.4.2.tar.gz
+3ea683f3a3cb9cd3f27c953655240ae3b5981e2103876a1c9d66fcdce02d4e0c9205aed78829de0c5577fd6414f32a662b472b329cb516fc5212381c71a9bd74  ffmpeg-n5.0.tar.gz
diff --git a/contrib/src/ffmpeg/ios-disable-b-frames.patch b/contrib/src/ffmpeg/ios-disable-b-frames.patch
index b0865881fb4b2e387e0ed5cf74eff757d0e030e1..c4f14cda12cde6e35367db8e9ef68b7801758ae5 100644
--- a/contrib/src/ffmpeg/ios-disable-b-frames.patch
+++ b/contrib/src/ffmpeg/ios-disable-b-frames.patch
@@ -1,21 +1,20 @@
-From b5afccbddc5877cc383b5b000d83071c3afb3318 Mon Sep 17 00:00:00 2001
-From: kkostiuk <kateryna.kostiuk@savoirfairelinux.com>
-Date: Tue, 27 Apr 2021 15:11:31 -0400
-Subject: [PATCH] changes
+From 81b86c3688049ca15352ba4ee66a5989928b8861 Mon Sep 17 00:00:00 2001
+From: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
+Date: Tue, 19 Jul 2022 13:18:20 -0300
+Subject: [PATCH] ios disable b frames
 
 ---
- libavcodec/videotoolboxenc.c | 19 +++++++++++++++++--
- 1 file changed, 17 insertions(+), 2 deletions(-)
+ libavcodec/videotoolboxenc.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
 
 diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
-index 9b7ee67..86b562e 100644
+index 418ff00b8d..9fab30fd69 100644
 --- a/libavcodec/videotoolboxenc.c
 +++ b/libavcodec/videotoolboxenc.c
-@@ -1389,7 +1389,19 @@ static int vtenc_configure_encoder(AVCodecContext *avctx)
-     }
+@@ -1434,6 +1434,20 @@ static int vtenc_configure_encoder(AVCodecContext *avctx)
  
      vtctx->codec_id = avctx->codec_id;
--    avctx->max_b_frames = 16;
+ 
 +    CFBooleanRef   has_b_frames_cfbool;
 +
 +    int error = VTSessionCopyProperty(vtctx->session,
@@ -29,21 +28,10 @@ index 9b7ee67..86b562e 100644
 +        }
 +        CFRelease(has_b_frames_cfbool);
 +    }
- 
++
      if (vtctx->codec_id == AV_CODEC_ID_H264) {
          vtctx->get_param_set_func = CMVideoFormatDescriptionGetH264ParameterSetAtIndex;
-@@ -1508,7 +1520,10 @@ static av_cold int vtenc_init(AVCodecContext *avctx)
-     if (!status && has_b_frames_cfbool) {
-         //Some devices don't output B-frames for main profile, even if requested.
-         // HEVC has b-pyramid
--        vtctx->has_b_frames = (CFBooleanGetValue(has_b_frames_cfbool) && avctx->codec_id == AV_CODEC_ID_HEVC) ? 2 : 1;
-+        vtctx->has_b_frames = CFBooleanGetValue(has_b_frames_cfbool); 
-+        if (vtctx->has_b_frames && avctx->codec_id == AV_CODEC_ID_HEVC) {
-+            vtctx->has_b_frames = 2;
-+        }
-         CFRelease(has_b_frames_cfbool);
-     }
-     avctx->has_b_frames = vtctx->has_b_frames;
+ 
 -- 
-2.24.3 (Apple Git-128)
+2.34.1
 
diff --git a/contrib/src/ffmpeg/package.json b/contrib/src/ffmpeg/package.json
index a5af29200f90f2ad35188b886b8cbd45fe99a90c..39b381dca9674371ff057aaf8f7a72a3c218068a 100644
--- a/contrib/src/ffmpeg/package.json
+++ b/contrib/src/ffmpeg/package.json
@@ -1,7 +1,7 @@
 {
     "name": "ffmpeg",
-    "version": "n4.4.2",
-    "url": "https://github.com/FFmpeg/FFmpeg/archive/__VERSION__.tar.gz",
+    "version": "n5.0",
+    "url": "https://git.ffmpeg.org/gitweb/ffmpeg.git/snapshot/__VERSION__.tar.gz",
     "deps": [
         "vpx",
         "x264",
@@ -13,13 +13,13 @@
         "change-RTCP-ratio.patch",
         "rtp_ext_abs_send_time.patch",
         "libopusenc-reload-packet-loss-at-encode.patch",
-        "libopusdec-enable-FEC.patch"
-    ],
-    "win_patches": [
+        "libopusdec-enable-FEC.patch",
         "windows-configure.patch",
         "windows-configure-ffnvcodec.patch",
         "windows-configure-libmfx.patch"
     ],
+    "win_patches": [
+    ],
     "project_paths": [],
     "with_env" : "10.0.16299.0",
     "custom_scripts": {
diff --git a/contrib/src/ffmpeg/rules.mak b/contrib/src/ffmpeg/rules.mak
index dec7490d90090fdefaa424a07d8370f1fd90290e..e677689f7bf7441914db6e4be011714b15bda6c4 100644
--- a/contrib/src/ffmpeg/rules.mak
+++ b/contrib/src/ffmpeg/rules.mak
@@ -1,4 +1,4 @@
-FFMPEG_HASH := n4.4.2
+FFMPEG_HASH := n5.0
 FFMPEG_URL := https://git.ffmpeg.org/gitweb/ffmpeg.git/snapshot/$(FFMPEG_HASH).tar.gz
 
 PKGS+=ffmpeg
diff --git a/contrib/src/ffmpeg/screen-sharing-x11-fix.patch b/contrib/src/ffmpeg/screen-sharing-x11-fix.patch
index 9ae7dafebeba1d0906c1ad9a37ee226b1c4f7f32..e54a3467067c0aaf940ea2a9f0885eb50f4f0c67 100644
--- a/contrib/src/ffmpeg/screen-sharing-x11-fix.patch
+++ b/contrib/src/ffmpeg/screen-sharing-x11-fix.patch
@@ -1,6 +1,6 @@
-From f498c487a24bd39f1adfaa51b415e93456d36612 Mon Sep 17 00:00:00 2001
-From: agsantos <aline.gondimsantos@savoirfairelinux.com>
-Date: Wed, 17 Nov 2021 12:37:32 -0500
+From c1b210534b15188c964b31dc47e172f8ed4aca55 Mon Sep 17 00:00:00 2001
+From: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
+Date: Tue, 19 Jul 2022 13:35:19 -0300
 Subject: [PATCH] Screen sharing x11 fixes
 
 + We can now have a single stream in the x11grab, which can be updated to follow window resizing
@@ -13,7 +13,7 @@ note: This is a custom patch for later rebase
  1 file changed, 45 insertions(+), 141 deletions(-)
 
 diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
-index 8e3292e577..406716682f 100644
+index 64a68ba497..76e654b424 100644
 --- a/libavdevice/xcbgrab.c
 +++ b/libavdevice/xcbgrab.c
 @@ -29,11 +29,6 @@
@@ -82,7 +82,7 @@ index 8e3292e577..406716682f 100644
 -    shmdt(data);
 -}
 -
--static AVBufferRef *allocate_shm_buffer(void *opaque, buffer_size_t size)
+-static AVBufferRef *allocate_shm_buffer(void *opaque, size_t size)
 -{
 -    xcb_connection_t *conn = opaque;
 -    xcb_shm_seg_t segment;
@@ -123,7 +123,7 @@ index 8e3292e577..406716682f 100644
 -        av_log(s, AV_LOG_ERROR, "Could not get shared memory buffer.\n");
 -        return AVERROR(ENOMEM);
 -    }
--    segment = (xcb_shm_seg_t)av_buffer_pool_buffer_get_opaque(buf);
+-    segment = (xcb_shm_seg_t)(uintptr_t)av_buffer_pool_buffer_get_opaque(buf);
 -
 -    iq = xcb_shm_get_image(c->conn, drawable,
 -                           c->x, c->y, c->width, c->height, ~0,
@@ -268,7 +268,7 @@ index 8e3292e577..406716682f 100644
 +        }
  
 -    setup = xcb_get_setup(c->conn);
-+        setup = xcb_get_setup(c->conn);
++       setup = xcb_get_setup(c->conn);
  
 -    c->screen = get_screen(setup, screen_num);
 -    if (!c->screen) {
@@ -298,5 +298,5 @@ index 8e3292e577..406716682f 100644
      if (c->draw_mouse) {
          if (!(c->draw_mouse = check_xfixes(c->conn))) {
 -- 
-2.30.2
+2.34.1
 
diff --git a/contrib/src/ffmpeg/windows-configure-ffnvcodec.patch b/contrib/src/ffmpeg/windows-configure-ffnvcodec.patch
index a946f176c55fa5c513932fc8c2a466717704ae93..201a8f6f4054878c05ce703bbd540f9f7a38523a 100644
--- a/contrib/src/ffmpeg/windows-configure-ffnvcodec.patch
+++ b/contrib/src/ffmpeg/windows-configure-ffnvcodec.patch
@@ -1,15 +1,17 @@
-From 4bb07a5a8306e27a430d6d62c7b7e23300d594a3 Mon Sep 17 00:00:00 2001
-From: Pierre Lespagnol <pierre.lespagnol@savoirfairelinux.com>
-Date: Fri, 29 Jan 2021 16:52:01 -0500
+From 93cb08f8eaabda03e2f3c70dc546a6fb72b2e752 Mon Sep 17 00:00:00 2001
+From: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
+Date: Tue, 19 Jul 2022 15:14:05 -0300
 Subject: [PATCH] windows ffnvcodec patch
 
 ---
  configure | 8 --------
  1 file changed, 8 deletions(-)
 
+diff --git a/configure b/configure
+index d0fb8a1fc3..4a6defcc78 100755
 --- a/configure
 +++ b/configure
-@@ -6246,14 +6246,6 @@ else
+@@ -6406,14 +6406,6 @@ else
      check_nvcc cuda_llvm
  fi
  
@@ -21,9 +23,9 @@ Subject: [PATCH] windows ffnvcodec patch
 -      check_pkg_config ffnvcodec "ffnvcodec >= 8.1.24.11 ffnvcodec < 8.2" "$ffnv_hdr_list" ""
 -fi
 -
- check_cpp_condition winrt windows.h "!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)"
- 
- if ! disabled w32threads && ! enabled pthreads; then
+ if enabled_all libglslang libshaderc; then
+     die "ERROR: libshaderc and libglslang are mutually exclusive, if in doubt, disable libglslang"
+ fi
 -- 
-2.27.0
+2.30.2.windows.1
 
diff --git a/contrib/src/ffmpeg/windows-configure-libmfx.patch b/contrib/src/ffmpeg/windows-configure-libmfx.patch
index bd7f63c0888071cebbb53c77ff8433d6bf35f376..2bb73674b423e88efa261adef735d3f4c4d58fc0 100644
--- a/contrib/src/ffmpeg/windows-configure-libmfx.patch
+++ b/contrib/src/ffmpeg/windows-configure-libmfx.patch
@@ -1,15 +1,17 @@
-From d8378480c349c5c4e30ca89fa68695661103c309 Mon Sep 17 00:00:00 2001
-From: Pierre Lespagnol <pierre.lespagnol@savoirfairelinux.com>
-Date: Fri, 29 Jan 2021 16:56:48 -0500
+From 7e3dd8d95bd8b0364bad194c180d1ccf24b88a05 Mon Sep 17 00:00:00 2001
+From: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
+Date: Tue, 19 Jul 2022 15:17:29 -0300
 Subject: [PATCH] windows libmfx patch
 
 ---
- configure | 2 --
- 1 file changed, 2 deletions(-)
+ configure | 5 -----
+ 1 file changed, 5 deletions(-)
 
+diff --git a/configure b/configure
+index 4a6defcc78..955db827fb 100755
 --- a/configure
 +++ b/configure
-@@ -6374,12 +6374,6 @@ enabled liblensfun        && require_pkg_config liblensfun lensfun lensfun.h lf_
+@@ -6547,11 +6547,6 @@ enabled liblensfun        && require_pkg_config liblensfun lensfun lensfun.h lf_
  # Media SDK or Intel Media Server Studio, these don't come with
  # pkg-config support.  Instead, users should make sure that the build
  # can find the libraries and headers through other means.
@@ -18,10 +20,9 @@ Subject: [PATCH] windows libmfx patch
 -if enabled libmfx; then
 -   check_cc MFX_CODEC_VP9 "mfx/mfxvp9.h mfx/mfxstructures.h" "MFX_CODEC_VP9"
 -fi
--
+ 
  enabled libmodplug        && require_pkg_config libmodplug libmodplug libmodplug/modplug.h ModPlug_Load
  enabled libmp3lame        && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame $libm_extralibs
- enabled libmysofa         && { check_pkg_config libmysofa libmysofa mysofa.h mysofa_neighborhood_init_withstepdefine ||
 -- 
-2.27.0
+2.30.2.windows.1
 
diff --git a/contrib/src/ffmpeg/windows-configure.patch b/contrib/src/ffmpeg/windows-configure.patch
index 427a5d7daf4d032edadb4c5bacff6e539b126ef2..df40601413c953c5dfa41fa3c856c16fb2432855 100644
--- a/contrib/src/ffmpeg/windows-configure.patch
+++ b/contrib/src/ffmpeg/windows-configure.patch
@@ -1,15 +1,17 @@
-From 1d10f0603d85336efef694036c884b1743572e1e Mon Sep 17 00:00:00 2001
-From: Pierre Lespagnol <pierre.lespagnol@savoirfairelinux.com>
-Date: Fri, 29 Jan 2021 16:08:55 -0500
+From 31afebe5d5659e7aa2a5919b6f163bf970e44578 Mon Sep 17 00:00:00 2001
+From: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
+Date: Tue, 19 Jul 2022 15:08:45 -0300
 Subject: [PATCH] windows configure patch
 
 ---
  configure | 35 +----------------------------------
  1 file changed, 1 insertion(+), 34 deletions(-)
 
+diff --git a/configure b/configure
+index 6b5ef6332e..d0fb8a1fc3 100755
 --- a/configure
 +++ b/configure
-@@ -1578,7 +1578,7 @@ require_cpp_condition(){
+@@ -1621,7 +1621,7 @@ require_cpp_condition(){
  require_pkg_config(){
      log require_pkg_config "$@"
      pkg_version="$2"
@@ -17,8 +19,8 @@ Subject: [PATCH] windows configure patch
 +    #check_pkg_config "$@" || die "ERROR: $pkg_version not found using pkg-config$pkg_config_fail_message"
  }
  
- test_host_cc(){
-@@ -6436,28 +6436,6 @@ enabled libvo_amrwbenc    && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_in
+ require_pkg_config_cpp(){
+@@ -6620,28 +6620,6 @@ enabled libvo_amrwbenc    && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_in
  enabled libvorbis         && require_pkg_config libvorbis vorbis vorbis/codec.h vorbis_info_init &&
                               require_pkg_config libvorbisenc vorbisenc vorbis/vorbisenc.h vorbis_encode_init
  
@@ -47,7 +49,7 @@ Subject: [PATCH] windows configure patch
  enabled libwebp           && {
      enabled libwebp_encoder      && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
      enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
-@@ -7140,17 +7118,6 @@ flatten_extralibs_wrapper(){
+@@ -7325,17 +7303,6 @@ flatten_extralibs_wrapper(){
      eval printf \''%s'\' \""\$$list_name"\"
  }
  
@@ -66,4 +68,5 @@ Subject: [PATCH] windows configure patch
      eval ${linkunit}_extralibs=\$\(flatten_extralibs_wrapper ${linkunit}_extralibs\)
  done
 -- 
-2.27.0
\ No newline at end of file
+2.30.2.windows.1
+
diff --git a/src/media/media_encoder.cpp b/src/media/media_encoder.cpp
index 7e2de3363297ec7f99eaa1527b792b9f7e2cc4bc..0e865d2b97296fe5d454e4a5702ce087bc7ef0c2 100644
--- a/src/media/media_encoder.cpp
+++ b/src/media/media_encoder.cpp
@@ -335,11 +335,8 @@ MediaEncoder::initStream(const SystemCodecInfo& systemCodecInfo, AVBufferRef* fr
             throw MediaEncoderException("Could not open encoder");
     }
 
-#ifndef _WIN32
     avcodec_parameters_from_context(stream->codecpar, encoderCtx);
-#else
-    stream->codec = encoderCtx;
-#endif
+
     // framerate is not copied from encoderCtx to stream
     stream->avg_frame_rate = encoderCtx->framerate;
 #ifdef ENABLE_VIDEO
@@ -578,11 +575,7 @@ std::string
 MediaEncoder::print_sdp()
 {
     /* theora sdp can be huge */
-#ifndef _WIN32
     const auto sdp_size = outputCtx_->streams[currentStreamIdx_]->codecpar->extradata_size + 2048;
-#else
-    const auto sdp_size = outputCtx_->streams[currentStreamIdx_]->codec->extradata_size + 2048;
-#endif
     std::string sdp(sdp_size, '\0');
     av_sdp_create(&outputCtx_, 1, &(*sdp.begin()), sdp_size);