Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
This repository was archived by the owner on May 22, 2025. It is now read-only.

Unable to convert m4a/mp4 files with correct duration -- works when using ffmpeg directly #1314

@mattpodolak

Description

@mattpodolak

Version information

  • fluent-ffmpeg version: ^2.1.3
  • ffmpeg version: 6.1-full_build-www.gyan.dev
  • OS: Windows 10

Code to reproduce

test-3-copy.mp4
ffmpeg()
        .input('./test-3-copy.mp4')
        .on('start', commandline => {
          console.log(`Spawned ffmpeg with command: ${commandline}`)
        })
        .on('stderr', stderrLine => console.log('FFmpeg STDERR:', stderrLine))
        .save('save-output-3.mp3')

(note: if the problem only happens with some inputs, include a link to such an input file)

Expected results

  • full length of file to be converted into mp3
  • correct duration and bitrate printed in the logs that match the outputs of using ffmpeg directly
$ ./ffmpeg -i ./test-3-copy.mp4 -y save-output-4.mp3
ffmpeg version 6.1-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom 
--enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass 
--enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-dxva2 --enable-d3d11va --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './test-3-copy.mp4':
  Metadata:
    major_brand     : iso5
    minor_version   : 1
    compatible_brands: isomiso5hlsf
    creation_time   : 2024-12-15T00:35:29.000000Z
  Duration: 00:00:13.55, start: 0.000000, bitrate: 188 kb/s
  Stream #0:0[0x1](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 186 kb/s (default)
    Metadata:
      creation_time   : 2024-12-15T00:35:29.000000Z
      handler_name    : Core Media Audio
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (aac (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Output #0, mp3, to 'save-output-4.mp3':
  Metadata:
    major_brand     : iso5
    minor_version   : 1
    compatible_brands: isomiso5hlsf
    TSSE            : Lavf60.16.100
  Stream #0:0(und): Audio: mp3, 48000 Hz, mono, fltp (default)
    Metadata:
      creation_time   : 2024-12-15T00:35:29.000000Z
      handler_name    : Core Media Audio
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.31.102 libmp3lame
[out#0/mp3 @ 0000022c486a7d00] video:0kB audio:106kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.307347%
size=     106kB time=00:00:13.53 bitrate=  64.4kbits/s speed=98.5x

Observed results

  • incorrect duration of output mp3
  • logs dont match - incorrect input duration and bitrate
Spawned ffmpeg with command: ffmpeg -i ./test-3-copy.mp4 -y save-output-3.mp3
FFmpeg STDERR: ffmpeg version N-92722-gf22fcd4483 Copyright (c) 2000-2018 the FFmpeg developers
FFmpeg STDERR:   built with gcc 8.2.1 (GCC) 20181201
FFmpeg STDERR:   configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmptFFmpeg STDERR:   libavutil      56. 24.101 / 56. 24.101
FFmpeg STDERR:   libavcodec     58. 42.102 / 58. 42.102
FFmpeg STDERR:   libavformat    58. 24.101 / 58. 24.101
FFmpeg STDERR:   libavdevice    58.  6.101 / 58.  6.101
FFmpeg STDERR:   libavfilter     7. 46.101 /  7. 46.101
FFmpeg STDERR:   libswscale      5.  4.100 /  5.  4.100
FFmpeg STDERR:   libswresample   3.  4.100 /  3.  4.100
FFmpeg STDERR:   libpostproc    55.  4.100 / 55.  4.100
FFmpeg STDERR: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './test-3-copy.mp4':
FFmpeg STDERR:   Metadata:
FFmpeg STDERR:     major_brand     : iso5
FFmpeg STDERR:     minor_version   : 1
FFmpeg STDERR:     compatible_brands: isomiso5hlsf
FFmpeg STDERR:     creation_time   : 2024-12-15T00:35:29.000000Z
FFmpeg STDERR:   Duration: 00:00:00.98, start: 0.000000, bitrate: 2602 kb/s
FFmpeg STDERR:     Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 2573 kb/s (default)
FFmpeg STDERR:     Metadata:
FFmpeg STDERR:       creation_time   : 2024-12-15T00:35:29.000000Z
FFmpeg STDERR:       handler_name    : Core Media Audio
FFmpeg STDERR: Stream mapping:
FFmpeg STDERR:   Stream #0:0 -> #0:0 (aac (native) -> mp3 (libmp3lame))
FFmpeg STDERR: Press [q] to stop, [?] for help
FFmpeg STDERR: Output #0, mp3, to 'save-output-3.mp3':
FFmpeg STDERR:   Metadata:
FFmpeg STDERR:     major_brand     : iso5
FFmpeg STDERR:     minor_version   : 1
FFmpeg STDERR:     compatible_brands: isomiso5hlsf
FFmpeg STDERR:     TSSE            : Lavf58.24.101
FFmpeg STDERR:     Stream #0:0(und): Audio: mp3 (libmp3lame), 48000 Hz, mono, fltp (default)  
FFmpeg STDERR:     Metadata:
FFmpeg STDERR:       creation_time   : 2024-12-15T00:35:29.000000Z
FFmpeg STDERR:       handler_name    : Core Media Audio
FFmpeg STDERR:       encoder         : Lavc58.42.102 libmp3lame
FFmpeg STDERR: size=       8kB time=00:00:00.98 bitrate=  68.2kbits/s speed=33.4x    
FFmpeg STDERR: video:0kB audio:8kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.141865%
FFmpeg STDERR:

Checklist

  • I have read the FAQ
  • I tried the same with command line ffmpeg and it works correctly (hint: if the problem also happens this way, this is an ffmpeg problem and you're not reporting it to the right place)
  • I have included full stderr/stdout output from ffmpeg

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions