RE: Batch ffmpeg process, so the 6CH AAC audio track is decoded to 6CH PCM WAV
1) download ffmpeg , place a copy of ffmpeg.exe in the folder of files to be converted (it's easier this way, if you're not familiar with paths, or setting up environment variables)
2) open a text file with notepad in the same folder, copy & paste the following, save it, change the extension from .txt to .bat . e.g batch.txt to batch.bat
3) double click the .bat fileCode:for %%a in ("*.ts") do ffmpeg -i "%%a" -map 0:1 -vn -c:a pcm_s16le "%%~na.wav" pause
The wav files will take on the filename of the source e.g a folder with file1.ts, file2.ts will result in file1.wav , file2.wav added to the folder
This will only work if the wanted audio is the 1st stream (not stream zero , which is usually the video) as in your sample. Some other files that you mentioned might have other stream mapping and you would have to change the -map number
You can tell the mapping by using ffmpeg -i input.ext
In your sample, stream 0:1 is the 6ch audio, so -map 0:1 is used in the commandline .
Input #0, mpegts, from 'sample_0.ts':
Duration: 00:00:32.36, start: 0.200000, bitrate: 7776 kb/s
Program 17598
Stream #0:0[0x19c9]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv
, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 24.75 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x19ca](eng): Audio: aac_latm (LC) ([17][0][0][0] / 0x0011), 480
00 Hz, 5.1, fltp
Stream #0:2[0x19cb](eng): Audio: aac_latm (HE-AACv2) ([17][0][0][0] / 0x0011
), 48000 Hz, stereo, fltp
Stream #0:3[0x19cc](eng): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 31 to 56 of 56
Thread
-
-
http://en.wikipedia.org/wiki/Advanced_Audio_Coding#Container_formats
If the program you choose does not support the LATM encapsulation-mode of AAC,
then you'll find a problem
Just follow DeathRay's instructions, for the time being. -
@poisondeathray
Are you actually doing this? I have a lot bad experience with ffmpeg not keeping av sync with TS files.
@Tafflad
It some special format not everywhere supported I think, is decoding a option for you? That should be easy but getting rid of LATM without re-encoding I don't know if and how it can be done. -
Originally Posted by poisondeathray;2391
This will only work if the wanted audio is the 1st stream (not stream zero , which is usually the video) as in your sample. Some other files that you mentioned might have other stream mapping and you would have to change the -map number
You can tell the mapping by using ffmpeg -i input.ext
In your sample, stream 0:1 is the 6ch audio, so -map 0:1 is used in the commandline .
[quote
Notice there are 2 streams with each file ...
Stream 1 AAC LC VBR 6 ch
Stream 2 AAC LC-SBR CBR 1ch
will that be OK ? -
Yes it works, but it really depends on the source file. If source file is poorly recorded, full of discontinunities - you need to "repair" it first and even that might not work. Broadcast transport streams are like that. Newer model PVR's tend not to have nearly as many problems as older ones a few years ago
His sample was in sync when converted with ffmpeg to MOV, but it was only 32sec long , he will have to see what happens on a longer sample
Yep, the -map 0:1 tells ffmpeg to select stream 1, which is the 6ch audio
Did you want both audio streams ? -
Guys .... I don't know which of the audio streams will contain the program content so assume that I would need both.
If there is an easier way that FFMEG then please do tell ..... I'll go with simplest.
as for the muxing/decoding .......... whatever it takes to allow me to get the audio & video into Vegas.
I will ultimately be creating PAL DVD's -
Ah. The 2012 Opening Ceremony
Now I took your sample (it does play in VLC) and imported it into avidemux.
Just select the first audio track from the audio menu.
Then selected copy for video, ac3 lav (changed bit rate to 192 kbps) for audio and mpeg TS as the output format.
Here is the result.
BTW Had this, the closing ceremony and lots in between on BBC DVD for agesLast edited by DB83; 17th May 2015 at 17:50. Reason: addit info
-
Would it be a fair assumption that the 6ch audio if present is the "main" audio ? 1ch audio probably wouldn't be. You still have to manually select what you want. Some streams might have 8 or more audio tracks e.g. different languages, but usually only in stereo . You should take a look and get a feel for what you're streams are like
-
Vegas sometimes problems with ffmpeg or ffmbc's transport streams. It seems to be semi related to the vegas version as well
Are you able to play AVC/MOV files in vegas ? Some people have a "black screen" bug that usually has to do with incompatible quicktime vs. vegas version. But that saves you the step of lining up audio with the video, assuming you have version/configuration that works
If you don't like the ffmpeg method, the "old" method people used years ago before ffmpeg got LATM support was to demux with DGAVCIndex and convert with winamp (winamp had the only accessible LATM/LOAS decoder at the time) -
-
-
Just tried it ... nope initially thought it was fine ... video loaded with separate sound track.
So all looked good ... pressed play .. and first 5 sec of video played fine along with audio, but then video freezes (on Albion Square frame) but audio continues playing OK. If you try to skip forward Vegas goes 'Not Responding'
Does play OK (audio & Video in Splash)
Video shows as:
1920x1081x12, 50 fps, Progressive scan, AVC
Audio shows as:
Audio 48,000Hz, 5.1 Surround (stereo downmix) (2 local streams), Dolby AC3
On the audio side it does initially advise 'there are multiple tracks' and sets it for 5.1 .... but when you see audio tracks on screen there are only 3:
Front, Centre and LFELast edited by Tafflad; 18th May 2015 at 07:24.
-
Some more options tried :
Using VideoReDo it has an option to
a) Converted AAC LATM to ADTS headers – but once again when loaded into Vegas .. no Audio
b) saving as elementary streams - but .m2V video not recognised by Vegas
c) re-encoded with audio as AAc - video loads into Vegas and plays OK, but no audio
best result so far ...
d) re-encoded with audio as MPEG Layer2 - video Loads and plays but only single audio track ... not the multiple tracks (5.1) .... the multiple audio tracks box was ticked in Save as options.
So still looking for solution. -
I've been following this thread for a few days now and wanted to help you and this is what i did to extract the audio from the sample you posted on the thread.
1) ran sample in VideoRedo to remove LATM-Header and saved the file as Sample-Latm-Removed.ts
2) then ran Sample-Latm-Removed.ts in ffmpeg with the following cmdline which gives a nice m4a file which is much better
ffmpeg -i Sample-Latm-Removed.ts -map 0:1 -vn -acodec copy -bsf:a aac_adtstoasc Sample-Latm-Removed-audio.m4a
which still keeps the channels in order as you should see also i've attached the AC3 file for you to check it out if you want todo so.
Below is outputs from mediaplayer classic and mediainfo
Mediainfo Output
General
Complete name : sample_audio.m4a
Format : MPEG-4
Format profile : Apple audio with iTunes info
Codec ID : M4A
File size : 1.20 MiB
Duration : 31s 851ms
Overall bit rate mode : Variable
Overall bit rate : 317 Kbps
Audio
ID : 1
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 31s 851ms
Bit rate mode : Variable
Bit rate : 315 Kbps
Maximum bit rate : 331 Kbps
Channel(s) : 2 channels
Channel(s)_Original : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 1.20 MiB (99%)Media Player Classic Output
Audio: AAC 48000Hz 6ch 315kbps [A: SoundHandler (aac, 48000 Hz, 5.1, 315 kb/s)]Mediainfo Output
Complete name : sample_audio.ac3
Format : AC-3
Format/Info : Audio Coding 3
File size : 1.46 MiB
Duration : 31s 872ms
Overall bit rate mode : Constant
Overall bit rate : 384 Kbps
Audio
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Duration : 31s 872ms
Bit rate mode : Constant
Bit rate : 384 Kbps
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 1.46 MiB (100%)Media Player Classic Output
Audio: Dolby AC3 48000Hz 6ch 384kbps [A: ac3, 48000 Hz, 5.1, 384 kb/s] -
Thanks for the effort .. in the first part .. you say "ran sample in VideoRedo to remove LATM-Header and saved the file as Sample-Latm-Removed.ts"
Do you mean by using 'save as > profile options > advanced options > Audio option > convert AAC LATM to ADTS headers' ?
If not can you give a bit more detail as unfamiliar with VideoRedo
However a bit more fundamental the sample file you attached (AC3) will not import into Vegas ... it does not see it as a valid file type.
I even ignore import and tried to drop direct onto project timeline ... no go.
The Tech specs state the following types supported:
Import: AA3, AAC, AIFF, AVI, BMP, CDA, FLAC, GIF, JPEG, MP3, MPEG-1, MPEG-2, MPEG-4, MVC, OGG, OMA, PCA, PNG, QuickTime, RealMedia, SFA, SND, W64, WAV, WDP, WMA, WMV
Export: AA3,AAC, AC3, AIFF, AVC, AVI, BMP, FLAC, JPEG, LPEC, MP3, MPEG-2, MPEG-4, MVC, OGG, PCA, PNG, QuickTime, RealMedia, TIFF, W64, WAV, WDP, WMA, WMV
Perhaps the path towards AC3 as a standalone file was in error, came about as suggestion earlier in thread for converting from AAC
Only shows AC3 as supported for output not for importLast edited by Tafflad; 19th May 2015 at 17:00.
-
-
OK ... good news both of those audio files will load & play in Vegas .aac and .m4a
At what point in proceedings did the .aac file get produced its not mentioned n your text ?
The simplest least steps to get either of those formats may be the answer.
In case of use I also have a copy of SoundForge in case that helps in the equation.
Second part to this ... as this seems to produce a working sound file, is it worth stripping out the original AAC stream audio from the .ts file to provide a clean video file to go with separate audio track. -
The .aac file is produced the same way like the .m4a file just remove -bsf:a aac_adtstoasc and change .m4a to .aac to get a working file once you stripped the latm header in videoredo.
ffmpeg -i Sample-Latm-Removed.ts -map 0:1 -vn -acodec copy -bsf:a aac_adtstoasc Sample-Latm-Removed-audio.m4a -
all seems to work produced working audio files.
2 questions ...
# The original Audio was VBR. When I remove LATM with VideoRedo... should I leave this as automatic or select AAC and set to a CBR of 192Kbs
# is there a way to strip audio stream out of the original .ts file so I would then be loading new audio file and clean video file into Vegas ... as Vegas does not like the AAC file muxed in the original .ts stream .... might it cause issues. -
Have now found a one-step solution that produces a video file that Vegas is happy with and the 5.1 audio tracks.
Thought I'd put details in case the issue comes up for someone else.
Opened file in VideoReDo
Imported profile attached
Save as 'H.264 MP4, Recode AAC' (I set it to 2-pass in options)
It works and imports happily into Vegas.
I don't understand the profile technicalities - but no doubt there are guys here who do.
The steps the profile achieves are :
1) Recodes the 5.1 AAC audio from the format used by the broadcaster in a transport stream to a format more suitable for Vegas.
2) Changes the muxing from a transport stream to an MP4 format.
3) Removed the 2nd audio stream from the output file.
Mediainfo now shows specific codes rather than the 6601 (0x19C9) / 6602 (0x19C9) windows codes which I assume relate to .ts , and is now mpeg-4 rather than mpeg-ts, and video codec AVC1 rather than '27' -
Been away a few days do could not contribute.
Asked if my remux worked for you since it did not load/run correctly in my old version although the sound was now fine. Just like you encountered.
I was gonna ask what version etc. of Vegas you were using just in case that was the issue here.
What I would suggest if you only want to do trim edits of these sources is just load them into avidemus. Remove the 2nd audio track as I did. Do A/B edits which are quite quick - you will see the I-frames in the program where your edits should go. Export as copy video, audio as ac3. Then let avstodvd do the hard work in creating the dvd. Might even make a better go of it than Vegas.
Just a thought. -
-
I read your reply. That was exactly as I found it. Audio plays. Video freezes. Vegas crashes.
Just in case it really is a Vegas issue, what particular version of Vegas are you using ? Just in case it is down to a HD issue. (just a thought)
But since you now have a mux that does appear to load ok then discount that. Just a lot of extra work to get something working in your editor of choice. -
It is Movie Studio Platinum 12 ....lots of posts on Vegas forum of guys who had same issue on multiple versions ... seems Vegas is pretty picky when it comes to ts muxed streams.
Similar Threads
-
MPEG StreamClip - H.264 MP4 w/AC3 audio loses audio
By the_wallcrawler in forum Video ConversionReplies: 5Last Post: 25th Jan 2014, 04:05 -
Avidemux loses all audio when I use audio shift option
By itm2 in forum EditingReplies: 5Last Post: 31st Mar 2013, 16:39 -
Remux audio with MPEG Streamclip
By dgerson76 in forum MacReplies: 7Last Post: 29th Jul 2012, 03:29 -
Editing TiVo Recording (MPEG2/AC3) with MPEG Streamclip loses audio
By DarthEd in forum MacReplies: 15Last Post: 4th May 2012, 08:28 -
80% MKV remux on H.264 - M2ts remux Aero Theme
By BJ12 in forum Video ConversionReplies: 2Last Post: 12th Aug 2011, 13:59