Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Recording video and audio with AAC audio codec don't play back correctly in Windows Media Player because of wrong audio codec.
Forum Updated to NodeBB v4.3 + New Features

Recording video and audio with AAC audio codec don't play back correctly in Windows Media Player because of wrong audio codec.

Scheduled Pinned Locked Moved Unsolved General and Desktop
multimediaaudio recordcodec
2 Posts 2 Posters 235 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    chris_4000
    wrote on 27 Dec 2024, 15:48 last edited by
    #1

    How to reproduce:

    • Build and run the "Camera Example" on Windows
    • Switch to "Video" mode
    • Settings: Either keep the "Default audio codec" or set to "Advanced Audio Codec (AAC)" - both create the same file format.
    • Record a video file and make some noise.
    • Play back the video in Windows Media Player (without any additional codecs/packs installed)
    • There is no audio!

    ffprobe of the generated file results in:

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video_0004.mp4':
    [...]
      Duration: 00:00:04.35, start: 0.000000, bitrate: 3924 kb/s
      Stream #0:0[0x1](und): Audio: aac (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 54 kb/s (default)
    [...]
      Stream #0:1[0x2](und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(progressive), 1280x720, 3905 kb/s, SAR 1:1 DAR 16:9, 30.20 fps, 60 tbr, 30k tbn [...]
    

    Interestingly, reencoding the audio of the generated file using ffmpeg.exe -i video_0004.mp4 -acodec aac -vcodec copy video_0004_reencoded.mp4 results in a file that plays back correctly in Windows Media Player.

    The reencoded file's ffprobe output is:

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\ChristophNiederberge\Videos\video_0004_reencoded.mp4':
    [...]
      Duration: 00:00:04.35, start: 0.000000, bitrate: 3924 kb/s
      Stream #0:0[0x1](und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(progressive), 1280x720, 3875 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 60 tbr, 30k tbn 
    [...]
      Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 54 kb/s (default)
    [...]
    

    With the subtle but important difference of having a aac (LC) instead of the aac as audio codec information.

    Notes:

    • This is independent of the container format
    • This is independent of the video codec
    • This is independent of the audio sample rate (afaik)
    • This is independent of the video resolution
    • This is independent of the encoding quality or bitrate settings
    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on 28 Dec 2024, 04:58 last edited by
      #2

      Regarding your notes: it may be independent of all those things but it may be dependent on the compiler toolchain used, the Qt version in use, and the Windows version for both recording and playback.

      The Windows component that generated the audio stream provided something odd that Windows Media Player cannot understand. ffmpeg produces valid AAC Low Complexity the Windows Media Player does understand. It's unclear what the original stream is. If the original stream was AAC Main Profile then ffprobe would have reported "Audio: aac (Main) (mp4a / 0x6134706D)...". High Efficiency AAC would be reported as "Audio: aac (HE-AAC) (mp4a / 0x6134706D)" (and less likely to be playable).

      Does the audio play correctly if extracted from the container?

      ffmpeg.exe -i original_video.mp4 -c: copy -vn original_video_audio.m4a
      
      1 Reply Last reply
      1

      1/2

      27 Dec 2024, 15:48

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved