Avidemux Forum

Avidemux => Main version 2.6 => Topic started by: stormlamp on January 13, 2016, 01:44:41 PM

Title: [FLAC]No supported Audio after copy
Post by: stormlamp on January 13, 2016, 01:44:41 PM
Hello,

I have a *.mkv video with flac-Audio.

Video: 1280*720 at 25 FPS, AVC (high@L4.1) /CABAC / 7 Ref Frames)
Audio: 48 kHz, 16 bits, 2 channels, FLAC

The Audio track is about 0.4 seconds earlier than the video.

I opened the file with Avidemux 2.6.10.
The main window shows:
Video Decoder: Lavcodec
Video Output: Copy
Audio Output: Copy
Shift: -40 ms
Output Format: AVI Muxer

If I then save the file, I cannot play it on my Samsung TV. There is no problem with the origin *.mkv file but with the new saved *.avi file.
I get the message: The audio format is not supported.

What shall I do?

Greatings
stormlamp





Title: Re: No supported Audio after copy
Post by: Jan Gruuthuse on January 13, 2016, 02:07:29 PM
try Audio Output: MP3 lame (or any other supported audio codec in any supported Output Format by Samsung)
even in the combination Samsung could be very picky.
Title: Re: No supported Audio after copy
Post by: stormlamp on January 13, 2016, 04:11:23 PM
It doesn't work:

Video Decoder: Lavcodec
Video Output: Copy
Audio Output: Copy
Shift: -60 ms
Output Format: AVI Muxer
------------------------------------------> audio format not supported
Video Decoder: Lavcodec
Video Output: Copy
Audio Output: MP3 lame
Shift: -60 ms
Output Format: AVI Muxer
------------------------------------------> no sound
Video Decoder: Lavcodec
Video Output: Copy
Audio Output: MP3 lame
Shift: -60 ms
Output Format: MKV Muxer
------------------------------------------> converting not supported
Video Decoder: Lavcodec
Video Output: Copy
Audio Output: Mp3 lame
Shift: -60 ms
Output Format: MP4 Muxer
------------------------------------------> no sound
Video Decoder: Lavcodec
Video Output: Copy
Audio Output: AC3 lav
Shift: -60 ms
Output Format: MP4 Muxer
------------------------------------------> no sound

Does anyone has an idea, how to delay an audio track without loosing the quality and in a way that a Samsung TV can play it?

Greatings
stormlamp
Title: Re: No supported Audio after copy
Post by: Jan Gruuthuse on January 13, 2016, 05:03:21 PM
You can find a 34.8 MB mp4 video with mp3 audio track, here to test on Samsung: http://avidemux.org/smif/index.php/topic,12094.msg73304.html#msg73304

Strange does work here:
load video, select only one track
Avidemux Menu -> Audio - Select Track ->
Track 1 [v] enabled [Track 0 ....] [Unknown] [MP3 (lame)
[OK]
Video Output:
[Copy]

Output Format
[Mkv Muxer]

If that did not work, can you upload 10 second video, similar to that what you want to convert?
ps: Use a free dropbox account, mega or similar webservice (free public access, without registration to download your uploaded video) thank you.

Title: Re: No supported Audio after copy
Post by: stormlamp on January 14, 2016, 05:31:53 PM
Hello Jan,

the demo file works after the conversion as you described.

But I cannot convert my original file. I have cut a small part of it.

This cut works on my Samsung TV, but after using Avidemux there is no Sound.

Here I stored the short file:
https://www.dropbox.com/s/u4q0evjdisgps5l/Test%20720p%20BluRay%20FLAC%202.0%20x264%2800h11m05s-00h11m23s%29-002.mkv?dl=0

Greetings
Title: Re: No supported Audio after copy
Post by: AQUAR on January 15, 2016, 06:37:09 AM
I don't think FLAC is supported by ADM (at least not in the near past).

If you need to recode anything:
Suggest you demux the source media and recode the FLAC audio track into an ADM compatible audio format (eg MP3).
      If you have VLC it can extract and convert the audio track (tried it on your sample).
      There must be other free programs around that can do this as well.
Simply add this recoded audio version back into ADM and deselect the original FLAC audio track of the source media.
Now the audio will play in ADM and you can re-sync / recode / edit the media file as required.
I am sure there must be more elegant ways to do this with ADM (use avisynth).

If you don't want to recode anything (just time shift the audio!):
Just use the free MKVtoolnix package to remux the streams into the MKV container.
      You can set the audio time shift in MKVtoolnix for the audio track no problem.
      This way you keep the FLAC audio track but it will be time shifted.

Title: Re: No supported Audio after copy
Post by: Jan Gruuthuse on January 15, 2016, 08:29:43 AM
Confirmed: Flac is not supported in avidemux.
You could extract audio from video with audacity and then export to mp3 or other wanted format.
When you have mp3 track:
- Avidemux Menu: Audio -> Select Track
- In Audio Tracks configuration:
- Track 1 [v] Enabled click on: [Track 0 from video (unknown codec, Stereo, 128kbps) and select in drop down list:
- .... Add audio track, and browse to the exported mp3 track and select it.


extracted flac audio track exported to mp3: FlacToMp3
inserted mp3 track: Test 720p BluRay FLAC 2.0 x264(00h11m05s-00h11m23s)-002.mp3
downloads available for one week (educational purpose only)
Title: Re: No supported Audio after copy
Post by: gino2812 on September 11, 2016, 01:21:51 AM
Quote from: Jan Gruuthuse on January 15, 2016, 08:29:43 AM
Confirmed: Flac is not supported in avidemux.
You could extract audio from video with audacity and then export to mp3 or other wanted format.
When you have mp3 track:
- Avidemux Menu: Audio -> Select Track
- In Audio Tracks configuration:
- Track 1 [v] Enabled click on: [Track 0 from video (unknown codec, Stereo, 128kbps) and select in drop down list:
- .... Add audio track, and browse to the exported mp3 track and select it.


extracted flac audio track exported to mp3: FlacToMp3
inserted mp3 track: Test 720p BluRay FLAC 2.0 x264(00h11m05s-00h11m23s)-002.mp3
downloads available for one week (educational purpose only)

Hi, sorry to revive this post, but I want to know if the Flac codec is still  unsupported.
Also, if possible, I wanna know if there are any plans to solve this issue.
Title: Re: No supported Audio after copy
Post by: eumagga0x2a on September 11, 2016, 01:24:09 PM
Unfortunately, FLAC is still unsupported. To edit a MKV with FLAC audio, reencode it with ffmpeg first

ffmpeg -i your-video-with-flac-audio.mkv -c:v copy -c:a pcm_s16le your-video-with-pcm-audio.mkv

then cut it in copy mode keeping MKV as container with Avidemux and convert it back into a MKV with FLAC audio with ffmpeg:

ffmpeg -i your-cut-video-with-pcm-audio.mkv -c:v copy -c:a flac your-cut-video-with-flac-audio.mkv

Please note that the problem is aggravated by the fact that Avidemux seems not to accept s32le format. If your FLAC audio was previously in that format, you will have quality loss. This doesn't matter if the original audio was 16 bit anyway, of course.
Title: Re: No supported Audio after copy
Post by: gino2812 on September 11, 2016, 08:14:32 PM
Quote from: eumagga0x2a on September 11, 2016, 01:24:09 PM
Unfortunately, FLAC is still unsupported. To edit a MKV with FLAC audio, reencode it with ffmpeg first

ffmpeg -i your-video-with-flac-audio.mkv -c:v copy -c:a pcm_s16le your-video-with-pcm-audio.mkv

then cut it in copy mode keeping MKV as container with Avidemux and convert it back into a MKV with FLAC audio with ffmpeg:

ffmpeg -i your-cut-video-with-pcm-audio.mkv -c:v copy -c:a flac your-cut-video-with-flac-audio.mkv

Please note that the problem is aggravated by the fact that Avidemux seems not to accept s32le format. If your FLAC audio was previously in that format, you will have quality loss. This doesn't matter if the original audio was 16 bit anyway, of course.

Ok, thank you.
I was trying to have a video able to be played on my tv. For this to happen, I need AAC, mp3 or ac3, audio. Best if its CBR, 'cause VBR, jumps some problems now and then.

It seems I'm gonna need something special to work with all FLAC. Fortunately I test audacity and it can do the trick.
Title: Re: No supported Audio after copy
Post by: eumagga0x2a on September 11, 2016, 10:01:01 PM
Quote from: gino2812 on September 11, 2016, 08:14:32 PM
I was trying to have a video able to be played on my tv. For this to happen, I need AAC, mp3 or ac3, audio.

If preservation of the original audio quality is not the top priority, the task gets even simpler:

ffmpeg -i your-video-with-flac-audio.mkv -c:v copy -c:a aac -b:a 192k your-video-with-aac-audio.mkv

192k should be more than enough for stereo. Use 384k for surround sound.

Avidemux is handy if you need to cut video. ffmpeg is best for dull converting tasks.

QuoteIt seems I'm gonna need something special to work with all FLAC. Fortunately I test audacity and it can do the trick.

Why using Audacity for such a primitive task?
Title: Re: No supported Audio after copy
Post by: Jan Gruuthuse on September 12, 2016, 04:19:43 AM
Quote from: eumagga0x2a on September 11, 2016, 10:01:01 PM
Why using Audacity for such a primitive task?
- Always nice to have visual oversight, at a glance you see if there is something wrong (graphical wave representation of audio track).
- Asked what track if multiple track.
- ...
Title: Re: No supported Audio after copy
Post by: Jan Gruuthuse on September 12, 2016, 11:12:31 AM
good news, following commits:
Quote655408f    [audio/Decoder] Add flac support for mkv
08473bf    [audio] Use correct fourcc for flac
should become available shortly in nightly
Title: Re: No supported Audio after copy
Post by: eumagga0x2a on September 12, 2016, 01:18:24 PM
Unfortunately, the newly added FLAC support in Avidemux is of little or no use for now. Avidemux consistently crashes playing (or saving) my ffmpeg generated test MKVs with FLAC audio longer than just a couple of minutes in duration:

Segfault
at line 0, file ??ADM_backTrack

ADM_EditorSegment::getSegment(int)
ADM_edAudioTrackFromVideo::getCurrentTrack()
ADM_edAudioTrackFromVideo::getPCMPacket(float*, unsigned int, unsigned int*, unsigned long*)
AUDMAudioFilter_Bridge::fillIncomingBuffer(AUD_Status*)
AUDMAudioFilter_Bridge::fill(unsigned int, float*, AUD_Status*)
AUDMAudioFilter::fillIncomingBuffer(AUD_Status*)
AUDMAudioFilterMixer::fill(unsigned int, float*, AUD_Status*)
GUIPlayback::audioPump(bool)
GUIPlayback::run()
GUI_PlayAvi()
HandleAction(Action)
/usr/local/bin/avidemux3_qt5() [0x4a1383]
QMetaObject::activate(QObject*, int, int, void**)
MainWindow::actionSignal(Action)
MainWindow::searchMenu(QAction*, MenuEntry*, int)
/usr/local/bin/avidemux3_qt5() [0x4a121c]
QMetaObject::activate(QObject*, int, int, void**)
QMenu::triggered(QAction*)


QMetaObject::activate(QObject*, int, int, void**)
QAction::triggered(bool)
QAction::activate(QAction::ActionEvent)
QAction::event(QEvent*)
QApplicationPrivate::notify_helper(QObject*, QEvent*)
QApplication::notify(QObject*, QEvent*)
QCoreApplication::notifyInternal2(QObject*, QEvent*)
QShortcutMap::dispatchEvent(QKeyEvent*)


and there is no FLAC support in muxer yet.

I'm a bit unsure if adding new core features and making a release a few days later fit well together...
Title: Re: No supported Audio after copy
Post by: Jan Gruuthuse on September 12, 2016, 01:30:43 PM
decoder = reading only (for now?)
Title: Re: No supported Audio after copy
Post by: eumagga0x2a on September 12, 2016, 02:37:57 PM
Quote from: Jan Gruuthuse on September 12, 2016, 01:30:43 PM
decoder = reading only (for now?)

I'm sorry, but I don't understand what you wanted to say or to ask. Demuxer is for reading, decoder for decoding, encoder for encoding, muxer for writing. They all receive data (read data) from other components and send data (write data) to other components. Avidemux is now in principle capable to demux and to decode MKV with FLAC audio, but crashes soon after playback (or saving with audio re-encoded with a different codec) start. There is no support in encoder and in MKV muxer yet.
Title: Re: No supported Audio after copy
Post by: mean on September 12, 2016, 03:06:51 PM
?
Does not crash here
Is there something special about your file ?
Title: Re: No supported Audio after copy
Post by: mean on September 12, 2016, 03:07:46 PM
The risk is very small, it's just enabling something in lavcodec
Title: Re: No supported Audio after copy
Post by: eumagga0x2a on September 12, 2016, 08:33:11 PM
Quote from: mean on September 12, 2016, 03:06:51 PM
Does not crash here
Is there something special about your file ?

The sample that reproducibly crashes Avidemux was generated from YouTube video with the ID vi1JeWrIPeA and format 22 using

ffmpeg -i source-video.mp4 -c:v copy -c:a flac output-video.mkv

I tried also two other source videos, a short one (60 seconds in duration) not crashing Avidemux but a longer one (approx. 6 minutes long) resulting reproducibly in a crash.

PS: for the record:

ffmpeg -version
ffmpeg version 3.0.2 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 6.1.1 (GCC) 20160621 (Red Hat 6.1.1-3)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcdio --enable-indev=jack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-openal --enable-opencl --enable-libopencv --enable-opengl --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libx265 --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
libavutil      55. 17.103 / 55. 17.103
libavcodec     57. 24.102 / 57. 24.102
libavformat    57. 25.100 / 57. 25.100
libavdevice    57.  0.101 / 57.  0.101
libavfilter     6. 31.100 /  6. 31.100
libavresample   3.  0.  0 /  3.  0.  0
libswscale      4.  0.100 /  4.  0.100
libswresample   2.  0.101 /  2.  0.101
libpostproc    54.  0.100 / 54.  0.100
Title: Re: No supported Audio after copy
Post by: eumagga0x2a on September 13, 2016, 05:48:39 AM
Fixed by increasing threefold the audio buffer size: [editor/audio] Increase buffer size (https://github.com/mean00/avidemux2/commit/ebde4e149bb75bc9eeff34c7cc24da9c8dbc491e), thanks!

Now if only the MKV muxer could be easily enhanced to support FLAC to make cutting in copy mode work ;)
Title: Re: No supported Audio after copy
Post by: Jan Gruuthuse on September 13, 2016, 05:57:45 AM
Quote from: eumagga0x2a on September 12, 2016, 02:37:57 PM
Quote from: Jan Gruuthuse on September 12, 2016, 01:30:43 PM
decoder = reading only (for now?)

I'm sorry, but I don't understand what you wanted to say or to ask.
User terms:
- reading = loading video into avidemux (input)
- writing = saving video with avidemux (output)

(for now?) at this moment, possible to change in the (nearby) future.

I write (briefly) from user experience, so I can't make statements for developer(s).
Title: Re: No supported Audio after copy
Post by: eumagga0x2a on September 15, 2016, 05:17:32 PM
Quote from: eumagga0x2a on September 13, 2016, 05:48:39 AM
Now if only the MKV muxer could be easily enhanced to support FLAC to make cutting in copy mode work ;)

This wish came true  :)

[core/Muxer] Add flac support for muxing (incomplete) (https://github.com/mean00/avidemux2/commit/de4312a86dd5122493eba59ccddfda0b07c139aa)
[muxer/flac] Remove the flac header if it is alreay there, else libavformat will duplicate it (https://github.com/mean00/avidemux2/commit/6d479351b929515853a7fec16b93ef9dae6a2ed4)

Cutting MKV videos with FLAC audio works now, thanks!