VideoHelp Forum
+ Reply to Thread
Page 2 of 2
FirstFirst 1 2
Results 31 to 56 of 56
Thread
  1. 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

    Code:
    for %%a in ("*.ts") do ffmpeg -i "%%a" -map 0:1 -vn -c:a pcm_s16le "%%~na.wav"
    
    pause
    3) double click the .bat file


    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)
    Quote Quote  
  2. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    Originally Posted by Tafflad View Post
    Originally Posted by stax76 View Post
    This is your problem I highly suspect:

    Code:
    MuxingMode                : LATM
    what does that mean, what should it be ?
    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.
    Quote Quote  
  3. Member stax76's Avatar
    Join Date
    Nov 2009
    Location
    On thin ice
    Search PM
    @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.
    Quote Quote  
  4. 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

    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)
    [/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 ?
    Quote Quote  
  5. Originally Posted by stax76 View Post
    @poisondeathray

    Are you actually doing this? I have a lot bad experience with ffmpeg not keeping av sync with TS files.
    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




    Originally Posted by Tafflad View Post


    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 ?


    Yep, the -map 0:1 tells ffmpeg to select stream 1, which is the 6ch audio

    Did you want both audio streams ?
    Quote Quote  
  6. 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
    Quote Quote  
  7. Member DB83's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    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 ages
    Image Attached Files
    Last edited by DB83; 17th May 2015 at 17:50. Reason: addit info
    Quote Quote  
  8. 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
    Quote Quote  
  9. Originally Posted by DB83 View Post
    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 ages

    Agree the samples play in VLC (also splash, MCP, WMP) just not in Vegas
    Yep the 2 files are opening ceremony and closing ceremony ... been on my PVR since 2012 .. want to get them into Vegas to edit down to the cool parts and burn to DVD
    Quote Quote  
  10. Member DB83's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    So does my remux load etc. in Vegas ?
    Quote Quote  
  11. 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)
    Image Attached Files
    Quote Quote  
  12. Member
    Join Date
    Jan 2011
    Location
    Adelaide, Australia
    Search PM
    Hi Tafflad,

    I just ran your sample through MPEG2Repair & it errors with:

    Click image for larger version

Name:	error.jpg
Views:	810
Size:	10.7 KB
ID:	31771
    Quote Quote  
  13. Originally Posted by The Mariner View Post
    Hi Tafflad,

    I just ran your sample through MPEG2Repair & it errors with:

    Image
    [Attachment 31771 - Click to enlarge]
    Another option knocked down .... amazing how many so far - thanks for trying
    Quote Quote  
  14. Originally Posted by DB83 View Post
    So does my remux load etc. in Vegas ?
    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 LFE
    Last edited by Tafflad; 18th May 2015 at 07:24.
    Quote Quote  
  15. 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.
    Quote Quote  
  16. Member NiGHT-WiNG's Avatar
    Join Date
    May 2015
    Location
    Some sort of cave with bats flying around
    Search PM
    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
    3) then ran audcaity and imported Sample-Latm-Removed-audio.m4a into it and then picked export to AC3 and saved it with default options
    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]
    Image Attached Files
    Quote Quote  
  17. 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 import
    Last edited by Tafflad; 19th May 2015 at 17:00.
    Quote Quote  
  18. Member NiGHT-WiNG's Avatar
    Join Date
    May 2015
    Location
    Some sort of cave with bats flying around
    Search PM
    Originally Posted by Tafflad View Post
    Do you mean by using 'save as > profile options > advanced options > Audio option > convert AAC LATM to ADTS headers' ?
    Yes that removed the header on the file
    I've gone ahead and attached the M4A and AAC audio files to this post
    Image Attached Files
    Quote Quote  
  19. 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.
    Quote Quote  
  20. Member NiGHT-WiNG's Avatar
    Join Date
    May 2015
    Location
    Some sort of cave with bats flying around
    Search PM
    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
    Quote Quote  
  21. 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.
    Quote Quote  
  22. 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'
    Image Attached Files
    Quote Quote  
  23. Member DB83's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    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.
    Quote Quote  
  24. Originally Posted by DB83 View Post
    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.
    Not sure if I understand your Q... but did reply in #44 .... did load, audio played but video froze
    Quote Quote  
  25. Member DB83's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    Originally Posted by Tafflad View Post
    Originally Posted by DB83 View Post
    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.
    Not sure if I understand your Q... but did reply in #44 .... did load, audio played but video froze
    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.
    Quote Quote  
  26. 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.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!