Avidemux Forum

Avidemux => Unix-Like (Linux/Bsd/...) => Topic started by: liberodark on May 30, 2020, 09:23:48 AM

Title: Help for script & Debian 9 Compile.
Post by: liberodark on May 30, 2020, 09:23:48 AM
Hi,

I would like to defer the configuration of conversion from GUI to command line.

(https://i.imgur.com/8sDpfQW.png)

Project Export :


adm = Avidemux()
adm.loadVideo("/home/pc/Téléchargements/Move/Jurassic Park.mkv")
adm.clearSegments()
adm.addSegment(0, 0, 7596605832)
adm.markerA = 0
adm.markerB = 7596605832
adm.setPostProc(3, 3, 0)
adm.videoCodec("Copy")
adm.audioClearTracks()
adm.setSourceTrackLanguage(0,"fre")
adm.setSourceTrackLanguage(1,"eng")
adm.setSourceTrackLanguage(2,"fre")
adm.audioAddTrack(0)
adm.audioCodec(0, "Faac", "bitrate=128");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0, 0)
adm.audioAddTrack(1)
adm.audioCodec(1, "copy");
adm.audioSetDrc(1, 0)
adm.audioSetShift(1, 0, 0)
adm.audioAddTrack(2)
adm.audioCodec(2, "copy");
adm.audioSetDrc(2, 0)
adm.audioSetShift(2, 0, 0)
adm.setContainer("MP4V2", "optimize=0", "add_itunes_metadata=0")


My command line :


video_codec="Copy"
audio_codec="Faac"
audio_bitrate="128"
output_format="MP4V2"
avidemux3_cli --video-codec "$video_codec" --audio-codec "$audio_codec" --audio-bitrate "$audio_bitrate" --load "$file" --output-format "$output_format" --save "${file%.*}.mp4" --quit


Have make many tests but in GUI my conversion is work better than bash.
And i not found correct command line.
Have read the doc but nothing...
I want to manage to do the same conversion in cli.
If you have information about what I miss on the command line?

Best Regards
Title: Re: Help for script.
Post by: eumagga0x2a on May 30, 2020, 11:20:35 AM
First of all, it is better to use the MP4 muxer in a current Avidemux build instead of the legacy MP4v2 one. Additionally, Faac is maybe the fastest but quality-wise the worst of available AAC encoders.

In your project, you re-encode the first audio track leaving the two others in copy mode. Is it done intentionally?

Regarding the command line, the option "--audio-bitrate" doesn't exist (https://github.com/mean00/avidemux2/blob/master/avidemux/common/ADM_toolkit/automation.cpp#L77). It is just that 128 kbit/s is the default value for Faac.

The "--load" option should also come first as preceding options may be discarded by a subsequent loading of a video.

Generally, I'd suggest putting the codec and audio track configuration into a project script file while leaving out file load and segment layout and execute the script by the "--run" option after the input has been loaded by "--load".

QuoteHave make many tests but in GUI my conversion is work better than bash.

In which sense? Hardware acceleration and some filters are not available in the CLI version, but you are not using in your example anything which would not work on command line.
Title: Re: Help for script.
Post by: liberodark on May 30, 2020, 11:32:49 AM
Ok and that is better ?


video_codec="Copy"
audio_codec="LavAAC"
output_format="MP4"
avidemux3_cli --load "$file" --video-codec "$video_codec" --audio-codec "$audio_codec" --set-audio-language 0 --output-format "$output_format" --save "${file%.*}.mp4" --quit
Title: Re: Help for script.
Post by: eumagga0x2a on May 30, 2020, 11:49:05 AM
"--set-audio-language" requires two arguments, you probably should set language also for audio tracks 1 and 2, not just for 0. You should use Avidemux built from the current git master for the best experience with the MP4 muxer (to be clear, timestamp rounding was broken, resulting in timing jitter, and fixed in the late autumn, and time base handling was greatly improved during the winter).
Title: Re: Help for script.
Post by: liberodark on May 30, 2020, 11:58:44 AM
Have 2.7.4
But i need to compile 2.7.4 for Debian 9 too
Title: Re: Help for script.
Post by: eumagga0x2a on May 30, 2020, 12:01:49 PM
2.7.4 is very old.

(Very old code-wise, I am aware that we didn't make a release since then.)
Title: Re: Help for script.
Post by: liberodark on May 30, 2020, 12:16:40 PM
You have github link or source link ?

have found this : https://github.com/mean00/avidemux2 is a good repo ?

Ok have fixe sound and video issue with this :

video_codec="h264"
audio_codec="LavAAC"
output_format="MP4"
avidemux3_cli --load "$file" --output-format "$output_format" --video-codec "$video_codec" --audio-codec "$audio_codec" --save "${file%.*}.mp4" --quit


But have error on build :

run : bash bootStrap.bash --deb --with-cli


-- Found GNU Make

-- Configuring FFmpeg
CMake Error at /home/admin/avidemux2/cmake/admFFmpegBuild_helpers.cmake:282 (MESSAGE):
  configure returned <1>
Call Stack (most recent call first):
  /home/admin/avidemux2/cmake/admFFmpegBuild_native.cmake:57 (ADM_FF_BUILD_UNIX_STYLE)
  /home/admin/avidemux2/cmake/admFFmpegBuild.cmake:16 (include)
  CMakeLists.txt:94 (include)


CMake Error at /home/admin/avidemux2/cmake/admFFmpegBuild_helpers.cmake:283 (MESSAGE):
  configure output is <nasm/yasm not found or too old.  Use --disable-x86asm
  for a crippled build.

 

  If you think configure made a mistake, make sure you are using the latest

  version from Git.  If the latest version fails, report the problem to the

  mailing list or IRC #ffmpeg on irc.freenode.net.

  Include the log file "ffbuild/config.log" produced by configure as this
  will help

  solve the problem.

  >
Call Stack (most recent call first):
  /home/admin/avidemux2/cmake/admFFmpegBuild_native.cmake:57 (ADM_FF_BUILD_UNIX_STYLE)
  /home/admin/avidemux2/cmake/admFFmpegBuild.cmake:16 (include)
  CMakeLists.txt:94 (include)


CMake Error at /home/admin/avidemux2/cmake/admFFmpegBuild_helpers.cmake:284 (MESSAGE):
  An error occured
Call Stack (most recent call first):
  /home/admin/avidemux2/cmake/admFFmpegBuild_native.cmake:57 (ADM_FF_BUILD_UNIX_STYLE)
  /home/admin/avidemux2/cmake/admFFmpegBuild.cmake:16 (include)
  CMakeLists.txt:94 (include)


-- Configuring incomplete, errors occurred!
See also "/home/admin/avidemux2/buildCore/CMakeFiles/CMakeOutput.log".
** Failed at cmakeZ**
Title: Re: Help for script & Debian 9 Compile.
Post by: eumagga0x2a on May 30, 2020, 12:57:32 PM
Quote from: liberodark on May 30, 2020, 12:16:40 PM
have found this : https://github.com/mean00/avidemux2 is a good repo ?

Yes, it is the official one.

QuoteOk have fixe sound and video issue with this :

video_codec="h264"
audio_codec="LavAAC"
output_format="MP4"
avidemux3_cli --load "$file" --output-format "$output_format" --video-codec "$video_codec" --audio-codec "$audio_codec" --save "${file%.*}.mp4" --quit

"h264" is invalid. What sort of sound and video issue did you experience?

Anyway, it is pretty pointless to try to troubleshoot 2.7.4.

QuoteBut have error on build :

run : bash bootStrap.bash --deb --with-cli

Omit "--with-*", it is the default. You must install build dependencies first. If you can't use https://github.com/mean00/avidemux2/blob/master/createDebFromSourceUbuntu.bash (https://github.com/mean00/avidemux2/blob/master/createDebFromSourceUbuntu.bash) directly, install them manually.
Title: Re: Help for script & Debian 9 Compile.
Post by: liberodark on May 30, 2020, 01:05:41 PM
The sound and video issue is not in my PC.
Is in Streama a web mediacenter only accept to play mp4.

Now is fix have improve audio quality too with (FDK_AAC) :


video_codec="h264"
audio_codec="FDK_AAC"
output_format="MP4"
avidemux3_cli --load "$file" --output-format "$output_format" --video-codec "$video_codec" --audio-codec "$audio_codec" --save "${file%.*}.mp4" --quit
Title: Re: Help for script & Debian 9 Compile.
Post by: eumagga0x2a on May 30, 2020, 01:15:44 PM
As stated above, "h264" is invalid as encoder name.

For doing anything MP4, please use the current git.
Title: Re: Help for script & Debian 9 Compile.
Post by: liberodark on May 30, 2020, 01:19:10 PM
Im try to build from git now !

What is list of compatible encoder ?


On build have this error :


CMake Error at CMakeLists.txt:214 (ADD_SUBDIRECTORY):
  The source directory

    /home/admin/avidemux2/avidemux/qt4/i18n

  does not contain a CMakeLists.txt file.



**************************
***  Optional Library  ***
***      Summary       ***
**************************
*** Video Encoder      ***
    NVENC          No
*** Miscellaneous      ***
    gettext        Yes
    SDL            No
    XVideo         Yes
    OpenGL         Yes
**************************
***   Release Build    ***
**************************

-- Packager=deb, valid choices= {deb,rpm,tgz,none}

-- Configuring incomplete, errors occurred!
See also "/home/admin/avidemux2/buildQt5/CMakeFiles/CMakeOutput.log".
** Failed at cmakeZ**


But only need cli version not gui
Title: Re: Help for script & Debian 9 Compile.
Post by: eumagga0x2a on May 30, 2020, 01:28:15 PM
If you have no other choice but re-encode the video, then to encode as H.264 you would use "x264" for encoding in software.

Depending on your hardware and graphics driver, it might be possible to use a hardware accelerated encoder with the GUI version instead.
Title: Re: Help for script & Debian 9 Compile.
Post by: liberodark on May 30, 2020, 01:30:45 PM
Have two deb created is avidemux3-core-2.7.5-200530-runtime and avidemux3-core-2.7.5-200530-dev

but not have avidemux cli ...

Im trying other compile : bash bootStrap.bash --deb --without-qt --with-cli
Title: Re: Help for script & Debian 9 Compile.
Post by: eumagga0x2a on May 30, 2020, 01:32:08 PM
Quote from: liberodark on May 30, 2020, 01:19:10 PM
On build have this error :


CMake Error at CMakeLists.txt:214 (ADD_SUBDIRECTORY):
  The source directory

    /home/admin/avidemux2/avidemux/qt4/i18n

  does not contain a CMakeLists.txt file.

You've skipped https://avidemux.org/smif/index.php/topic,18371.msg87089.html#msg87089

QuoteBut only need cli version not gui

I don't know whether this is a good idea as you would lose a lot of plugins, but "--without-qt" should do the trick.
Title: Re: Help for script & Debian 9 Compile.
Post by: liberodark on May 30, 2020, 01:35:43 PM
Is for a server not for computer.
Just have cli
Title: Re: Help for script & Debian 9 Compile.
Post by: liberodark on May 30, 2020, 02:25:51 PM
Have see error the new version of avidemux-cli have change audio codec name.
You have list of new codec name ?
im not sure probably need more tests now have error in convertion files
Title: Re: Help for script & Debian 9 Compile.
Post by: eumagga0x2a on May 30, 2020, 02:50:41 PM
You haven't posted the error.

Encoder names haven't changed. If a particular encoder is not found, the plugin is likely missing completely, e.g. because it hasn't been built in the first place due to headers not installed.
Title: Re: Help for script & Debian 9 Compile.
Post by: eumagga0x2a on May 30, 2020, 02:56:45 PM
For fdk_aac encoder plugin being available you need libfdk-aac-dev (https://packages.debian.org/stretch/libfdk-aac-dev) to be installed in the build environment and libfdk-aac1 package installed in the system where Avidemux is run.
Title: Re: Help for script & Debian 9 Compile.
Post by: liberodark on May 30, 2020, 03:50:05 PM
This is my error log.

And im retry to rebuild packages with lib of fdk_aac
have what is lib for encoders ?
Have run first : createDebFromSourceUbuntu.bash but im not sure have install all libs.

My goal is to make same as :

ffmpeg -nostdin -i "$file" -vcodec h264 -acodec aac -strict -2 "${file%.*}.mp4

But more faster ffmpeg is too long for convert files in mp4 with aac

Have rebuild with aac libs but and reinstall all deb.
But is same is not converting correctly.
Title: Re: Help for script & Debian 9 Compile.
Post by: eumagga0x2a on May 30, 2020, 06:04:54 PM
Quote[ADM_ae_plugin] Scanning directory /usr/lib/ADM_plugins6/audioEncoders
[AudioEncoder] Loaded PCM version 01.00.00 wavTag :0x1
[AudioEncoder] Registered filter /usr/lib/ADM_plugins6/audioEncoders/libADM_ae_pcm.so as  PCM encoder plugin Mean 2008
[AudioEncoder] Loaded Opus version 01.00.00 wavTag :0x26ae
[AudioEncoder] Registered filter /usr/lib/ADM_plugins6/audioEncoders/libADM_ae_opus.so as  Opus encoder plugin Mean 2017
[AudioEncoder] Loaded LavAC3 version 01.00.00 wavTag :0x2000
[AudioEncoder] Registered filter /usr/lib/ADM_plugins6/audioEncoders/libADM_ae_lav_ac3.so as  AC3 LavCodec encoder plugin Mean 2008/2009
[AudioEncoder] Loaded LavAAC version 01.00.00 wavTag :0xff
[AudioEncoder] Registered filter /usr/lib/ADM_plugins6/audioEncoders/libADM_ae_lav_aac.so as  AAC LavCodec encoder plugin Mean 2008/2016
[AudioEncoder] Loaded Vorbis version 01.00.00 wavTag :0x676f
[AudioEncoder] Registered filter /usr/lib/ADM_plugins6/audioEncoders/libADM_ae_vorbis.so as  Vorbis encoder plugin Mean 2008
Unable to load [/usr/lib/ADM_plugins6/audioEncoders/libADM_ae_aften.so]: libaften.so.0: cannot open shared object file: No such file or directory
Symbol loading failed for /usr/lib/ADM_plugins6/audioEncoders/libADM_ae_aften.so
/usr/lib/ADM_plugins6/audioEncoders/libADM_ae_aften.so:CannotLoad
[AudioEncoder] Loaded Lame version 01.00.00 wavTag :0x55
[AudioEncoder] Registered filter /usr/lib/ADM_plugins6/audioEncoders/libADM_ae_lame.so as  Lame MP3 encoder plugin Mean 2009
[AudioEncoder] Loaded Faac version 01.00.00 wavTag :0xff
[AudioEncoder] Registered filter /usr/lib/ADM_plugins6/audioEncoders/libADM_ae_faac.so as  Faac AAC encoder plugin Mean 2008
[AudioEncoder] Loaded LavMP2 version 01.00.00 wavTag :0x50
[AudioEncoder] Registered filter /usr/lib/ADM_plugins6/audioEncoders/libADM_ae_lav_mp2.so as  MP2 LavCodec encoder plugin Mean 2008/2009
[ADM_ae_plugin] Scanning done

No plugin fdk_aac plugin built, you should check the build log from a full build why fdk_aac was not found despite headers and lib installed.

Aften plugin has been built, but library is not installed.

Quote from: liberodark on May 30, 2020, 03:50:05 PM
My goal is to make same as :

ffmpeg -nostdin -i "$file" -vcodec h264 -acodec aac -strict -2 "${file%.*}.mp4

But more faster ffmpeg is too long for convert files in mp4 with aac

"h264" in ffmpeg would invoke the same x264 encoder as in Avidemux. If you need a higher speed, you should either use a x264 preset favoring encoding speed at cost of quality, e.g.

ffmpeg -i "$file" -c:v libx264 -preset veryfast -crf 22 -c:a aac -b:a 128k out.mp4

or use a hardware accelerated encoder, which would top x264 by an order of magnitude at cost of low compression rate and poor keyframe placement. If I am not mistaken, you have to use a project script to request a non-default configuration for x264 in Avidemux.