News:

--

Main Menu

Crash when muxing AAC

Started by Blues, April 25, 2017, 12:19:12 AM

Previous topic - Next topic

Blues

I have a little script to convert WAV to AAC.
for i in *.wav ; do ffmpeg -i "$i" -c:a libfdk_aac -b:a 128k "${i%wav}aac" ; done
When I load the resulting file into Avidemux and attempt to create an MP4 Avidemux first complains this file is not suitable for this container and then crashes.
I am using the git version of Avidemux, just compiled today, FFmpeg is version 3.3.

Segfault
at line 0, file ??
ADM_backTrack
/lib64/libc.so.6() [0x3d0a6330d0]
av_log
avpriv_request_sample



av_write_frame
muxerFFmpeg::writePacket(AVPacket*)
muxerFFmpeg::saveLoop(char const*)
admSaver::save()
A_Save(char const*)
A_SaveWrapper(char const*)
ADM_QT4_fileSel::GUI_FileSelWriteExtension(char const*, char const*, void (*)(char const*))
HandleAction_Save(Action)
HandleAction(Action)
avidemux3_qt5() [0x4ab59e]
QMetaObject::activate(QObject*, int, int, void**)
MainWindow::actionSignal(Action)
MainWindow::searchToolBar(QAction*)
avidemux3_qt5() [0x4ab344]
QMetaObject::activate(QObject*, int, int, void**)
QToolBar::actionTriggered(QAction*)
/usr/lib64/libQt5Widgets.so.5() [0x324d8f529c]
QMetaObject::activate(QObject*, int, int, void**)
QToolButton::triggered(QAction*)
QMetaObject::activate(QObject*, int, int, void**)
QAction::triggered(bool)
QAction::activate(QAction::ActionEvent)
/usr/lib64/libQt5Widgets.so.5() [0x324d83ccbd]

Jan Gruuthuse

#1
Why not using the audio option of avidemux?
Load video, keep Video Output set to [Copy]
In Avidemux Menu: Audio drop down menu:
- Select Track
Track 1 [v]  Enebaled,change [Track 0 form video (....)] to [... Add audio track]
Browse to the wav file you want to use, select it, click [Open]
- change [Copy]  to the wanted encoding
[AAC (FDK)]
[AAC (Faac)]
[AAC (lav)]
[...]

[Configure] and select/change the presented options

apply [Filters] if wanted / needed.

When you have saved a video  which suits your needs.
Check the saved video with MediaInfo for the audio properties. Find out how to set these in your script with ffmpeg.




Blues

So you recommend to convert back to WAV before muxing. Not an ideal solution considering AAC is lossy.

p3trus

Quote from: Blues on April 25, 2017, 12:13:34 PM
So you recommend to convert back to WAV before muxing. Not an ideal solution considering AAC is lossy.

No - according to your first post, you have a video file, and your audio track as *.wav.
Jan suggested to skip your conversion script (<> NOT converting wav > aac with ffmpeg first), but load the wav audio track directly in ADM and let ADM do the conversion to aac.
Jan gave a perfect step-by-step instruction for this :)

Blues

I did not say nothing of the kind. The files are encoded to AAC, I merely described how they were encoded. Now I need to use them and Avidemux crashes. Can we stay on topic, please?

eumagga0x2a

If you load audio from an external file, does the duration of the audio at least equal the duration of the video?

mm0359

Blues, please provide sample files, so people can try and reproduce.

Blues

Audio file.

Avidemux loads it, but crashes when I try to mux it.

eumagga0x2a

#8
Decoding the sample as an external audio track crashes Avidemux in ADM_AudiocoderLavcodec::decodeToFloatPlanar(float **outptr,uint32_t *nbOut) from avidemux_plugins/ADM_audioDecoders/ADM_ad_lav.

Valgrind says, "Invalid read of size 4".


eumagga0x2a

I don't have libfdk installed, but encoding with

ffmpeg -i some_audio_file -c:a aac -b:a 192k output.aac

and loading the file as external audio track not only crashes Avidemux in the very same way but also the values displayed in the properties dialog are completely off:

ffprobe:

Input #0, aac, from 'test.aac':
  Duration: 00:07:11.54, bitrate: 188 kb/s
    Stream #0:0: Audio: aac (LC), 48000 Hz, stereo, fltp, 188 kb/s


Avidemux:

Codec: E-AC3
Channels: 6
Bitrate: 5000 Bps / 40 kbps
Frequency: 32000 Hz
Total Duration: 00:00:00.000



Blues

Good catch, thanks for confirming the bug.

eumagga0x2a

Likely something is wrong in ADM_EAC3GetInfo from avidemux_core/ADM_coreAudioParser/src/ADM_eac3info.cpp:23.

Apart from getting the bitrate wrong, Avidemux doesn't exhibit difficulties with the same audio when muxed in copy mode with ffmpeg.

eumagga0x2a

Okay, idAAACADTS always reports 128k as bitrate for AAC, so nothing surprising here :)

Swapping the order of checks for E-AC3 and AAC in ADM_identifyAudioStream sort of fixes this bug which originates from AAC getting misidentified as E-AC3 (on the other hand even misidentified stream should not result in a crash). I have no idea what will break if this band-aid gets applied, however.

Jan Gruuthuse

What I could think of (wild guessing)

- relation between actual channels (2,2.1, 5.0,5.1, ...) and used bitrate (compounded)
- limitation in maximum (allowed?) bitrate, bitrate/channel
- limitation in maximum (allowed?) kHz

above usage against different libraries: AAC (FDK),AAC (Faac), AAC (lav)

some more info: https://trac.ffmpeg.org/wiki/Encode/AAC
- As a rule of thumb, for audible transparency, use 64kb/s for each channel (so 128kb/s for stereo, 384 kb/s for 5.1 surround sound)
- Note: A bug exists in libfdk-aac 0.1.3 and earlier that will cause a crash when using high sample rates, such as 96kHz, with VBR mode 5.

eumagga0x2a

The E-AC3 detection has been fixed: [audio] Check deeper if it is eac3, the 2 frames must be right after one another. The fix will be in the 2.6.20 release as well.

Thank you for your report.