#1111314 simplescreenrecorder: Cannot record using MP4 and AAC

Package:
simplescreenrecorder
Source:
simplescreenrecorder
Description:
Feature-rich screen recorder for X11 and OpenGL
Submitter:
Mike L
Date:
2026-06-23 16:15:01 UTC
Severity:
normal
#1111314#5
Date:
2025-08-16 18:32:00 UTC
From:
To:
Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?

Tried recording a part of the screen using MP4 with h264 and AAC codecs on a
fresh Debian 13 install. Simplescreenrecorder was installed normally from the
Synaptic package manager.

   * What was the outcome of this action?

Got the following output:

[PageRecord::StartPage] Starting page ...
[PageRecord::StartPage] Started page.
[PageRecord::StartOutput] Starting output ...
[PageRecord::StartOutput] Output file:
/home/user/Videos/simplescreenrecorder-2025-08-16_15.26.09.mp4
[Muxer::Init] Using format mp4 (MP4 (MPEG-4 Part 14)).
[Muxer::AddStream] Using codec libx264 (libx264 H.264 / AVC / MPEG-4 AVC /
MPEG-4 part 10).
[VideoEncoder::PrepareStream] Using pixel format nv12.
[libx264 @ 0x55aa466eb840] using SAR=1/1
[libx264 @ 0x55aa466eb840] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX FMA3 BMI2 AVX2
[libx264 @ 0x55aa466eb840] profile High, level 3.2, 4:2:0, 8-bit
[libx264 @ 0x55aa466eb840] 264 - core 164 r3108 31e19f9 - H.264/MPEG-4 AVC
codec - Copyleft 2003-2023 - http://www.videolan.org/x264.html - options:
cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x3 me=dia subme=1 psy=1
psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0
deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12 lookahead_threads=2
sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1
open_gop=0 weightp=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0
rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40
pb_ratio=1.30 aq=1:1.00
[BaseEncoder::EncoderThread] Encoder thread started.
[Muxer::AddStream] Using codec aac (AAC (Advanced Audio Coding)).
[AudioEncoder::PrepareStream] Using sample format f32p.
[BaseEncoder::Init] Error: Can't open codec!
[aac @ 0x55aa466995c0] Unsupported channel layout "2 channels"
[aac @ 0x55aa466995c0] Qavg: nan
[BaseEncoder::~BaseEncoder] Stopping encoder thread ...
[BaseEncoder::EncoderThread] Encoder thread stopped.
[PageRecord::StartOutput] Error: Something went wrong during initialization.

#1111314#10
Date:
2026-05-29 04:01:37 UTC
From:
To:
I can confirm this bug for both AAC and MP3. I temporarily rebuild the
package with a simple fix from a llm so it is working for the time being.

#1111314#15
Date:
2026-05-29 09:06:03 UTC
From:
To:
Am 2026-05-29 06:01, schrieb Bob Rosbag:

If you could post that patch here...

Thanks,

  - Fabian

#1111314#20
Date:
2026-05-29 09:26:10 UTC
From:
To:
Ofcourse.
FYI, it was created with deepseek and I cannot determine if the code is
completely correct and safe but I did test it and both AAC and MP3 are
working now.
Someone still has to review this code.

Cheers,
Bob

#1111314#25
Date:
2026-06-23 16:02:58 UTC
From:
To:
I am also affected by this bug, analyzed it using Claude. Below is a
summary generated by Claude.

Cheers,
Armin




I can confirm this on Debian 13 (trixie) with simplescreenrecorder
0.4.4-6 and FFmpeg 7.1.1 (libavcodec61).

The failure is not specific to AAC — every strict encoder is affected.
With MP3 selected, libmp3lame gives a more explicit hint:

   [libmp3lame] Specified channel layout '2 channels' is not supported
by the libmp3lame encoder
   [libmp3lame] Supported channel layouts: mono, stereo

Root cause: the new-API branch added by 1020-ffmpeg-7.patch sets

   codec_context->ch_layout.nb_channels = channels;
   codec_context->ch_layout.u.mask = (channels == 1) ? AV_CH_LAYOUT_MONO
: AV_CH_LAYOUT_STEREO;

but leaves ch_layout.order at AV_CHANNEL_ORDER_UNSPEC. The encoders
therefore see an unnamed "2 channels" layout instead of "stereo" and
refuse to open.

Upstream already solves this. In src/AV/Output/AudioEncoder.cpp the
SSR_USE_AV_CHANNEL_LAYOUT branch uses:

   av_channel_layout_default(&codec_context->ch_layout, channels);

This sets order/nb_channels/mask correctly and covers both FFmpeg 7 and
8 in a single line. The cleanest fix is to make the Debian patch's #else
branch match upstream instead of assigning the fields by hand.

Regarding the patch already attached to this report: it is functionally
correct — av_channel_layout_from_mask() also produces a NATIVE-order
layout, so it does fix the bug. It is just more elaborate than
necessary; the single av_channel_layout_default() call above would be
sufficient and matches upstream exactly.

I have verified the upstream code path; the only divergence is the
version gate (upstream switches to the new API at libavcodec 59.24, the
Debian patch at major >= 61), which is harmless on trixie.