Author Topic: Error applying audio codec  (Read 253 times)

Varro

  • Newbie
  • *
  • Posts: 6
Error applying audio codec
« on: November 26, 2017, 06:00:34 PM »
Hi! I have files like:
Code: [Select]
=====================================================
Video
=====================================================
Codec 4CC: H264
Image Size: 640 x 480
Aspect Ratio: 1:1 (1:1)
Frame Rate: 29.971 fps
Total Duration: 00:00:51.151

=====================================================
Extra Video Properties
=====================================================
ExtraDataSize: 28
Extra data: 01 42 E0 1F FF E1 00 0D 67 42

=====================================================
Audio
=====================================================
Codec: PCM
Channels: Stereo
Bitrate: 192000 Bps / 1536 kbps
Frequency: 48000 Hz
Total Duration: 00:00:51.136


I want to convert them into files with video x264 with 2048 bitrate and audio MP3 192 with following batch file:
Code: [Select]
set avidemux="c:\Program Files\Avidemux 2.7 - 64 bits\avidemux.exe"
set videocodec=x264
set videobitrate=cbr=2048
set audiocodec=MP3
set audiobitrate=192
set outputformat=MP4
for %%f in (*.MOV) do %avidemux% --video-codec %videocodec% --video-conf %videobitrate% --audio-codec %audiocodec% --audio-bitrate %audiobitrate% --output-format %outputformat% --force-alt-h264 --load "%%f" --save "%%f.mp4" --quit

But:
1) when GUI is shown audio settings didn't load (they set to "Copy").
2) when converting i got error "Unsupported. Only AAC, AC3, E-AC3 and mpegaudio supported for audio"

How can i fix this problem?

Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 5674
Re: Error applying audio codec
« Reply #1 on: November 26, 2017, 06:08:33 PM »
Try with this
Code: [Select]
set audiocodec=Lame
If still refused try using MKV muxer

Varro

  • Newbie
  • *
  • Posts: 6
Re: Error applying audio codec
« Reply #2 on: November 26, 2017, 07:59:23 PM »
Try with this
Code: [Select]
set audiocodec=Lame
If still refused try using MKV muxer
I've tried MP3, AAC instead of "Lame" - with same result. I think main problem is that audio codec settings doesn't apply to GUI and conversion process. With manual setting via GUI i can convert this file successfully.

With MKV muxer - problem is that audio settings doesn't apply to output - it just copy.
« Last Edit: November 26, 2017, 08:13:53 PM by Varro »

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 1544
Re: Error applying audio codec
« Reply #3 on: November 26, 2017, 08:35:29 PM »
--load should come first.

Varro

  • Newbie
  • *
  • Posts: 6
Re: Error applying audio codec
« Reply #4 on: November 26, 2017, 08:46:18 PM »
--load should come first.
Same result. Order doesn't matter.

I write again - audio settings don't apply from command line to GUI and (as I think) to convert process.

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 1544
Re: Error applying audio codec
« Reply #5 on: November 26, 2017, 08:51:12 PM »
What version are you using?

Edit: nevermind, it is 2.7, probably 2.7.0 for win64.
« Last Edit: November 26, 2017, 11:36:25 PM by eumagga0x2a »

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 1544
Re: Error applying audio codec
« Reply #6 on: November 26, 2017, 09:01:31 PM »
The order matters exactly as I said. With the current version (for me it is the current git master, for you the latest win64 nightly if you don't build from source), I get exactly the same error if I don't put --load option with the source video file name including the path before any audio options. It works if the video is loaded first.

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 1544
Re: Error applying audio codec
« Reply #7 on: November 26, 2017, 11:39:03 PM »
Could you please post the output of MediaInfo for the source file? Maybe there are more audio tracks, and the command line converts only the first one.

Varro

  • Newbie
  • *
  • Posts: 6
Re: Error applying audio codec
« Reply #8 on: November 27, 2017, 04:25:04 PM »
Yes, version is 2.7 x64 downloaded yesterday from fosshub.

The order matters exactly as I said. With the current version (for me it is the current git master, for you the latest win64 nightly if you don't build from source), I get exactly the same error if I don't put --load option with the source video file name including the path before any audio options. It works if the video is loaded first.
I use modified example from wiki where "load" is after all codecs :)
Anyway with following config
Code: [Select]
set avidemux="c:\Program Files\Avidemux 2.7 - 64 bits\avidemux.exe"
set videocodec=x264
set videobitrate=cbr=2048
set audiocodec=MP3
set audiobitrate=192
set outputformat=MP4
for %%f in (*.MOV) do %avidemux% --load "%%f" --video-codec %videocodec% --video-conf %videobitrate% --audio-codec %audiocodec% --audio-bitrate %audiobitrate% --output-format %outputformat% --force-alt-h264 --save "%%f.mp4" --quit
I get same error "Unsupported. Only AAC, AC3, E-AC3 and mpegaudio supported for audio".

Could you please post the output of MediaInfo for the source file? Maybe there are more audio tracks, and the command line converts only the first one.
Code: [Select]
General
Complete name                  : D:\Convert\MVI_0906.MOV
Format                         : MPEG-4
Format profile                 : QuickTime
Codec ID                       : qt   2007.09 (qt  /CAEP)
File size                      : 43.8 MiB
Duration                       : 51 s 151 ms
Overall bit rate               : 7 188 kb/s
Encoded date                   : UTC 2017-09-24 19:04:34
Tagged date                    : UTC 2017-09-24 19:04:34
CNTH                           : яdяУяeяґяjя“яcяfяXя9яGяя5я.я#яgя2яҐяjядяҐя"
com.apple.quicktime.make       : Canon
com.apple.quicktime.model      : Canon PowerShot SX40 HS

Video
ID                             : 1
Format                         : AVC
Format/Info                    : Advanced Video Codec
Format profile                 : Baseline@L3.1
Format settings, CABAC         : No
Format settings, RefFrames     : 1 frame
Format settings, GOP           : M=1, N=15
Codec ID                       : avc1
Codec ID/Info                  : Advanced Video Coding
Duration                       : 51 s 151 ms
Bit rate                       : 5 637 kb/s
Width                          : 640 pixels
Height                         : 480 pixels
Display aspect ratio           : 4:3
Frame rate mode                : Constant
Frame rate                     : 29.970 (30000/1001) FPS
Color space                    : YUV
Chroma subsampling             : 4:2:0
Bit depth                      : 8 bits
Scan type                      : Progressive
Bits/(Pixel*Frame)             : 0.612
Stream size                    : 34.4 MiB (78%)
Language                       : English
Encoded date                   : UTC 2017-09-24 19:04:34
Tagged date                    : UTC 2017-09-24 19:04:34
Color range                    : Full
Color primaries                : BT.709
Transfer characteristics       : BT.709
Matrix coefficients            : BT.601

Audio
ID                             : 2
Format                         : PCM
Format settings, Endianness    : Little
Format settings, Sign          : Signed
Codec ID                       : sowt
Duration                       : 51 s 151 ms
Bit rate mode                  : Constant
Bit rate                       : 1 536 kb/s
Channel(s)                     : 2 channels
Channel positions              : Front: L R
Sampling rate                  : 48.0 kHz
Bit depth                      : 16 bits
Stream size                    : 9.37 MiB (21%)
Language                       : English
Encoded date                   : UTC 2017-09-24 19:04:34
Tagged date                    : UTC 2017-09-24 19:04:34

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 1544
Re: Error applying audio codec
« Reply #9 on: November 27, 2017, 04:36:55 PM »
Well, there is no second audio track... Could you please try the latest nightly then?

If you want the audio track to be encoded as MP3, use Lame as --audio-codec
« Last Edit: November 27, 2017, 04:42:00 PM by eumagga0x2a »

Varro

  • Newbie
  • *
  • Posts: 6
Re: Error applying audio codec
« Reply #10 on: November 27, 2017, 04:56:17 PM »
Build 171127 - much better. Output in GUI is set to MP3 (lame). But now i can't change audio bitrate - for any value audio bitrate remains 128 (i've set codec to lame).

Updated
Also I found following in log:
Code: [Select]
[audioCodecSetByName] 16:59:25-814 Audio codec Lame set for track 0 (index=7)

 Unknown command :--audio-bitrate

 Found garbage 192
« Last Edit: November 27, 2017, 05:07:34 PM by Varro »

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 1544
Re: Error applying audio codec
« Reply #11 on: November 27, 2017, 05:02:01 PM »
Looking into it.

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 1544
Re: Error applying audio codec
« Reply #12 on: November 27, 2017, 05:17:41 PM »
The --audio-bitrate option has been removed by this commit in March 2012. The Wiki is terribly outdated. Please use a project script (.py) to supply codec options, just don't forget always to load the video first.

Edit:

Code: [Select]
adm = Avidemux()
adm.audioCodec(0, "Lame", "bitrate=192", "preset=0", "quality=2", "disableBitReservoir=False");
« Last Edit: November 27, 2017, 05:22:13 PM by eumagga0x2a »

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 1544
Re: Error applying audio codec
« Reply #13 on: November 27, 2017, 05:50:09 PM »
The --video-conf option has gone too, as well as the --force-alt-h264 one. You should configure (with a video loaded) video and audio codecs and the output container to your liking in Avidemux, then save this as a project script, edit the resulting .py file deleting the lines starting with

Code: [Select]
adm.loadVideo
adm.clearSegments
adm.addSegment
adm.markerA
adm.markerB

and load the video on command line followed by --run "path/to/your/script.py". The batch would look like the following:

Code: [Select]
set avidemux="c:\Program Files\Avidemux 2.7 - 64 bits\avidemux.exe"
set project="path\to\edited\script.py"

for %%f in (*.MOV) do %avidemux% --load "%%f" --run %project% --save "%%f.mp4" --quit

Varro

  • Newbie
  • *
  • Posts: 6
Re: Error applying audio codec
« Reply #14 on: November 27, 2017, 06:01:18 PM »
Great, thank you for help and useful app!
Using previously saved project is much more convenient than specifing all in command line.