News:

--

Main Menu

Error applying audio codec

Started by Varro, November 26, 2017, 06:00:34 PM

Previous topic - Next topic

Varro

Hi! I have files like:
=====================================================
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:
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

Try with this
set audiocodec=Lame

If still refused try using MKV muxer

Varro

#2
Quote from: Jan Gruuthuse on November 26, 2017, 06:08:33 PM
Try with this
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.

eumagga0x2a


Varro

Quote from: eumagga0x2a on November 26, 2017, 08:35:29 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

#5
What version are you using?

Edit: nevermind, it is 2.7, probably 2.7.0 for win64.

eumagga0x2a

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

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

Yes, version is 2.7 x64 downloaded yesterday from fosshub.

Quote from: eumagga0x2a on November 26, 2017, 09:01:31 PMThe 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
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".

Quote from: eumagga0x2a 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.
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

#9
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

Varro

#10
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:
[audioCodecSetByName] 16:59:25-814 Audio codec Lame set for track 0 (index=7)

Unknown command :--audio-bitrate

Found garbage 192

eumagga0x2a


eumagga0x2a

#12
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:

adm = Avidemux()
adm.audioCodec(0, "Lame", "bitrate=192", "preset=0", "quality=2", "disableBitReservoir=False");

eumagga0x2a

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

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:

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

Great, thank you for help and useful app!
Using previously saved project is much more convenient than specifing all in command line.