Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Audio encoding
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd February 2009, 00:23   #1  |  Link
MNk
Registered User
 
MNk's Avatar
 
Join Date: Jan 2009
Posts: 2
Encode AAC audio in a video

Hello everyone,

I come to you for a rather technical question about using AAC encoding faac or neroAacEnc.
The goal is to encode an audio track in AAC 128kbit contained in a MOV or MP4 in a without having to extract it beforehand.

When I use MeGUI to encode the audio track contained in an MP4, simply:

1. Select the MP4 file, choose the encoder FAAC and select Raw-AAC for the format.



2. Put in the queue and start encoding.



It notes that during encoding, ffdshow is used to decode the audio and video, even if we agree that during this procedure, the video is useless.



It is therefore with a file. AAC encoder proper.

If we analyze the logs of MeGUI, it can be seen that before starting the encoding, it automatically creates an AviSynth script to decode the source file and encoding.

http://www.alexandrenest.com/faac/log.txt

Code:
Avisynth script
DirectShowSource ("C:\x264\myvideo.mp4")
EnsureVBRMP3Sync()
SSRC(44100)
Normalize()
return last
[b]Are attacking me now what is the problem.[/ b]

My goal is to create one .BAT automating the encoding of the audio, the encoding of the video track and muxer all in a MP4 container. The creation of a script prior AviSynth is mandatory and can handle as you wish, video and audio. It also, according to the source file, insert either DirectShowSource or by QTInput, etc ...

In short, my problem is that I can not encode the audio in the same MP4 using FAAC lines of code.

Example: 128-b faac.exe -mpeg-vers 4 -o "C:\x264\myvideo.aac" "C:\x264\myvideo.avs"

In a way, if I take the log created by MeGUI, I realize that the same AviSynth script and I run the same command line via a command prompt window, I get an error:

Could not open input file C:\x264\myvideo.avs

Yet if we try the script in AVSP, we see that the script is functional, video and audio are present, so no real worries that side.

After more than a night of searching all the forums, as doom9, etc... the only way that I imagine is that when you open the AVS script via the command line, it can not decode the source file. I infer that, because when MeGUI running this same command, the ffdshow icons appear, and there not.

I do not know if I explained my problem ... I guess for most people, this is Chinese, but all ideas are welcome.

Thank you in advance for all your answers,

Regards, Alex

PS : Sorry for my English, I'm French.
MNk is offline   Reply With Quote
Old 2nd February 2009, 04:12   #2  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Faac don't support avs input files. You can use Wavi (avs to wav) to 'pipe' the AviSynth wav output to Faac (or NeroAacEnc):

wavi "C:\x264\myvideo.avs" - | faac.exe -b 128 -mpeg-vers 4 -o "C:\x264\myvideo.aac" -
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 2nd February 2009, 06:30   #3  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,699
Small note.

If you do not want to decode the video of a directshow source simply use the following.

Quote:
Avisynth script
DirectShowSource ("C:\x264\myvideo.mp4", video=false)
EnsureVBRMP3Sync()
SSRC(44100)
Normalize()
return last
__________________
FAQs:Bond's AVC/H.264 FAQ
Site:Adubvideo
Adub is offline   Reply With Quote
Old 2nd February 2009, 12:07   #4  |  Link
audyovydeo
Registered User
 
audyovydeo's Avatar
 
Join Date: Apr 2007
Posts: 464
Quote:
Originally Posted by MNk View Post
I come to you for a rather technical question about using AAC encoding faac or neroAacEnc.
The goal is to encode an audio track in AAC 128kbit contained in a MOV or MP4 in a without having to extract it beforehand.


PS : Sorry for my English, I'm French.

If you want you can PM me in french.

Why do you encode a file containing AAC audio into a new one in AAC ?

just demux the audio part from the mp4 file :

download mp4box (kurtnoise.free.fr).

Code:
mp4box -info yourfile.mp4


Track # 1 Info - TrackID 1 - TimeScale 25 - Duration 00:00:55.480
Media Info: Language "Undetermined" - Type "vide:avc1" - 1387 samples
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 720 x 576 - Profile High @ Level 3
NAL Unit length bits: 32
Pixel Aspect Ratio 1:1 - Indicated track size 720 x 576
Self-synchronized

Track # 2 Info - TrackID 2 - TimeScale 48000 - Duration 00:00:55.594
Media Info: Language "Undetermined" - Type "soun:mp4a" - 1303 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 24000 - SBR SampleRate 48000
Synchronized on stream 1
then do :


Code:
mp4box -raw 2 tongbei06.mp4
Extracting MPEG-4 AAC

This will extract the audio to a separate AAC file, which you can decode with FAAD (also from kurtnoise.free.fr) to a wav file


!1 - I noticed that NeroAACdecoder did not manage to decode the aac audio done with QuickTime

!2 - mp4 files from changedotgov and whitehouse.gov seem to be done with QuickTime H264/AAC

salut
audyovydeo
audyovydeo is offline   Reply With Quote
Old 2nd February 2009, 15:16   #5  |  Link
MNk
Registered User
 
MNk's Avatar
 
Join Date: Jan 2009
Posts: 2
Hello,

Thank you for your help. WAVI is truly amazing... That is exactly what I was looking for a software that accepts AVS files and therefore decoding via ffdshow.

The goal is not to have to extract the audio of the video, I now just need to create the AVS file with all the scripts you want and run my encoding.

I'd like to share with you my script automatic encoding.

Thank you to you for your quick help.

audyovydeo, je te contacte quand même par PM !

Code:
CLS
@ECHO OFF

SET pathENCODE=C:\x264\
SET pathX264="C:\Program Files\megui\tools\x264\x264.exe"
SET pathWAVI="C:\Program Files\megui\tools\wavi\wavi.exe"
SET pathAAC="C:\Program Files\megui\tools\neroaacenc\neroaacenc.exe"
SET pathMP4="C:\Program Files\megui\tools\mp4box\mp4box.exe"

SET fichier=%1
SET fichierAVS=%1.avs
SET fichier264=%1.264
SET fichierWAV=%1.wav
SET fichierM4A=%1.m4a
SET fichierSTATS=%1.stats
SET fichierMUXED=%1-muxed.mp4
SET bitrate=%2
SET frameref=%3
SET fps=%4

ECHO #### Script d'encodage WEBCREATiV
ECHO #### Utilisation : webcreativ [avs] [bitrate] [frameref] [fps]
ECHO ####
ECHO #### [avs] = nom du script avs sans extention
ECHO #### [bitrate] = bitrate en kbits
ECHO #### [frameref] = nombre de frame de reference (8388608/width*height)
ECHO #### [fps] = nombre de fps de la video
ECHO ####
ECHO #### Fichier AVS : %pathENCODE%%fichierAVS%
ECHO #### Bitrate : %bitrate% kbits
ECHO #### Nb frame reference : %frameref%
ECHO #### FPS : %fps%
ECHO ####
ECHO #### Fichier final : %pathENCODE%%fichierMUXED%
ECHO ####
ECHO ####
ECHO ####

IF "%fichier%"=="" GOTO ERROR
IF "%bitrate%"=="" GOTO ERROR
IF "%frameref%"=="" GOTO ERROR
IF "%fps%"=="" GOTO ERROR

ECHO #### Encodage de l'audio M4V
ECHO #### %time%
ECHO ####

%pathWAVI% %pathENCODE%%fichierAVS% %pathENCODE%%fichierWAV%
%pathAAC% -ignorelength -hev2 -br 128000 -if "%pathENCODE%%fichierWAV%" -of "%pathENCODE%%fichierM4A%"

ECHO ####
ECHO ####
ECHO #### Encodage de la video x264 a %bitrate% kbits
ECHO #### %time%
ECHO ####

%pathX264% --pass 1 --bitrate %bitrate% --stats "%fichierSTATS%" --qcomp 0.2 --level 4.1 --ref %frameref% --mixed-refs --no-fast-pskip
--bframes 9 --b-pyramid --weightb --direct auto --subme 9 --analyse all --8x8dct --trellis 2 --b-adapt 2 --me esa --merange 16
--aq-strength 0.8 --threads auto --thread-input --progress --no-psnr --no-ssim --output NUL "%pathENCODE%%fichierAVS%"
%pathX264% --pass 2 --bitrate %bitrate% --stats "%fichierSTATS%" --qcomp 0.2 --level 4.1 --ref %frameref% --mixed-refs --no-fast-pskip
--bframes 9 --b-pyramid --weightb --direct auto --subme 9 --analyse all --8x8dct --trellis 2 --b-adapt 2 --me esa --merange 16
--aq-strength 0.8 --threads auto --thread-input --progress --no-psnr --no-ssim --output "%pathENCODE%%fichier264%" "%pathENCODE%%fichierAVS%"

ECHO ####
ECHO ####
ECHO #### Muxage au format mp4 (%fichierMUXED%)
ECHO #### %time%
ECHO ####

%pathMP4% -add "%pathENCODE%%fichier264%#video:fps=%4" -add "%pathENCODE%%fichierM4A%#audio" -new "%pathENCODE%%fichierMUXED%"

ECHO ####
ECHO ####
ECHO #### Nettoyage du dossier %pathENCODE%
ECHO #### %time%
ECHO ####
ECHO #### Suppression du fichier %pathENCODE%%fichier264%
ECHO #### Suppression du fichier %pathENCODE%%fichierWAV%
ECHO #### Suppression du fichier %pathENCODE%%fichierM4A%
ECHO #### Suppression du fichier %pathENCODE%%fichierSTATS%

DEL %pathENCODE%%fichier264%
DEL %pathENCODE%%fichierWAV%
DEL %pathENCODE%%fichierM4A%
DEL %pathENCODE%%fichierSTATS%

ECHO ####
ECHO ####
ECHO #### Fin de l'encodage.

:ERROR
Result : http://www.alexandrenest.com/faac/result.txt
MNk is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:44.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.