Opened 17 months ago

Closed 16 months ago

Last modified 16 months ago

#11531 closed defect (fixed)

[Regression] AAC audio in RTSP no more muxed with "-c copy"

Reported by: HelFix Owned by:
Priority: normal Component: ffmpeg
Version: git-master Keywords: AAC FFmpeg
Cc: MasterQuestionable, Jack Lau Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: yes

Description (last modified by HelFix)

Summary of the bug:

  • How to reproduce:
  • Use the following command with an RTSP stream:
    ffmpeg -rtsp_transport tcp -i rtsp://admin:admin@10.15.129.19:554/Streaming/Channels/102 -c:v copy -c:a copy output.mp4
    
  • Test with:

ffmpeg-n7.1-39-g64e2864cb9-linux64-gpl-7.1 or 6.1.1 (works).
ffmpeg-n7.1-62-gb168ed9b14-linux64-gpl-7.1 and newer (fails).

  • Expected Behavior:

Both video and audio streams are muxed into output.mp4. In n7.1-39, ffprobe shows:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Media Presentation
    encoder         : Lavf61.7.100
  Duration: 00:00:04.95, start: 0.000000, bitrate: 2591 kb/s
  Stream #0:0[0x1](und): Video: h264 (Baseline) (avc1 / 0x31637661), yuvj420p(pc, progressive), 1920x536 [SAR 1:1 DAR 240:67], 2558 kb/s, 19.80 fps, 20 tbr, 90k tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 32000 Hz, mono, fltp, 26 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]
  • Actual Behavior:

In n7.1-62:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Media Presentation
    encoder         : Lavf61.7.100
  Duration: 00:00:09.15, start: 0.000000, bitrate: 1918 kb/s
  Stream #0:0[0x1](und): Video: h264 (Baseline) (avc1 / 0x31637661), yuvj420p(pc, progressive), 1920x536 [SAR 1:1 DAR 240:67], 1917 kb/s, 19.34 fps, 20 tbr, 90k tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]

Video is muxed (e.g., 219 packets, 2116297 bytes).
Audio is read (e.g., 366 packets, 39746 bytes) but not muxed (0 packets, 0 bytes).
Example log from a similar 7.1 failure:

[in#0/rtsp] Input stream #0:1 (audio): 366 packets read (39746 bytes);
[out#0/mp4] Output stream #0:1 (audio): 0 packets muxed (0 bytes);
[rtsp @ 0x6044978bfbc0] SDP:
v=0
o=- 1743073449707371 1743073449707371 IN IP4 10.15.129.19
s=Media Presentation
e=NONE
b=AS:5100
t=0 0
a=control:rtsp://10.15.129.19:554/Streaming/Channels/102/
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:5000
a=recvonly
a=x-dimensions:1920,536
a=control:rtsp://10.15.129.19:554/Streaming/Channels/102/trackID=1
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=Z0IAM4qKUDwCK8v/gACAALZAAAD6AAATiAE=,aM48gA==
m=audio 0 RTP/AVP 104
c=IN IP4 0.0.0.0
b=AS:50
a=recvonly
a=control:rtsp://10.15.129.19:554/Streaming/Channels/102/trackID=2
a=rtpmap:104 mpeg4-generic/32000/1
a=fmtp:104 profile-level-id=15; streamtype=5; mode=AAC-hbr; config=1288;SizeLength=13; IndexLength=3; IndexDeltaLength=3; Profile=1;
a=Media_header:MEDIAINFO=494D4B48010300000400000101200110007D0000007D000000000000000000000000000000000000;
a=appversion:1.0
  • Environment:

OS: Ubuntu 24.04
Builds: BtbN static Linux 64-bit GPL from https://github.com/BtbN/FFmpeg-Builds.

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Change History (11)

comment:1 by HelFix, 17 months ago

Description: modified (diff)

comment:2 by HelFix, 17 months ago

Description: modified (diff)

comment:3 by MasterQuestionable, 17 months ago

Analyzed by developer: set
Cc: MasterQuestionable added
Summary: Audio stream not muxed with -c:a copy from RTSP[Regression] AAC audio in RTSP no more muxed with "-c copy"

comment:4 by HelFix, 17 months ago

i found that commit

The regression is caused by commit f265f9c9d04863180503707bfad285f48e6bf080

  • avcodec/codec_desc: remove Intra Only prop for AAC
Last edited 17 months ago by HelFix (previous) (diff)

comment:5 by MasterQuestionable, 17 months ago

͏    What's the input characteristics?
͏    Does it affect simply the AAC file?

in reply to:  5 comment:6 by HelFix, 17 months ago

Replying to MasterQuestionable:

͏    What's the input characteristics?
͏    Does it affect simply the AAC file?

Hello, what do you mean, do you have any command what i can run? Or is there any way to record that rtsp raw?

comment:7 by MasterQuestionable, 16 months ago

͏    The regressor commit doesn't look like RTSP specific.
͏    So I suspect it would also fail the plain AAC.

͏    Try "-c copy" the RTSP stream with a previous working FFmpeg.
͏    ("-map" only the audio and output as ".aac")
͏    .
͏    Test whether the AAC alone could reproduce the same problem.

comment:8 by HelFix, 16 months ago

ok, i tried

ffmpeg version n7.1-55-g4b801baa46

ffmpeg -rtsp_transport tcp -i RTPS -c:v copy -c:a copy -map 0:a output.aac

ffmpeg version n7.1-56-gf265f9c9d0

ffmpeg -i output.aac -c:a copy -map 0:a output2.aac

i wasn't able to replicate same issue.

so i setup public restream from my rtsp for only audio

rtsp://185.91.117.52:8554/mystream
(fixed)

if i do

ffmpeg -rtsp_transport tcp -i rtsp://185.91.117.52:8554/mystream -c:a copy output.aac

ffmpeg version n7.1-55-g4b801baa46 - working ok
ffmpeg version n7.1-56-gf265f9c9d0 - output.aac output size is 0 kb

Last edited 16 months ago by HelFix (previous) (diff)

in reply to:  8 comment:9 by Jack Lau, 16 months ago

Cc: Jack Lau added
Resolution: wontfix
Status: newclosed
Version: 7.1git-master

Replying to HelFix:

ffmpeg version n7.1-56-gf265f9c9d0 - output.aac output size is 0 kb

I think it's not a bug, you need to add option -copyinkf in your FFmpeg command if the aac not have k frames.

ffmpeg -rtsp_transport tcp -i rtsp://localhost:8554/cap/live -c:a copy -copyinkf test.aac -y

In my case, it works well.

comment:10 by Jack Lau, 16 months ago

Resolution: wontfixfixed

i found the root reason after careful research,

this indeed a bug because rtsp aac didn't set the need_parsing so that it cannot mark keyframe

Should be fixed in this patch https://ffmpeg.org/pipermail/ffmpeg-devel/2025-April/341989.html

Note: See TracTickets for help on using tickets.