VideoHelp Forum
+ Reply to Thread
Results 1 to 13 of 13
Thread
  1. Hello, I need to remove audio tracks #1 and #2 from ~200 mkv files (which are in the same folder). I guess mkvtoolnix will do the job, but would someone tell me, how to automatize this operation? Thx in advance
    Quote Quote  
  2. I am not pretty familiar, but mkvextract (if it's a part of mkvtoolnix) will help to extract tracks with track ids.
    you have to write your own batch or script.
    Quote Quote  
  3. If the audio tracks have language tagging you could use Hybrid:
    1. start Hybrid
    2. set "Main->Primary Input Selection->Video handling" to "passthrough"
    3. set "Main->Primary Input Selection->Audio handling" to "passthrough all"
    4. set "Config->Output->Container Settings->General Settings->Standard output container" to "mkv"
      If you require some special mkv compatibility settings to be enabled, check out "Config->Output->Container Settings->Mkv Settings" and dis-/enable what you need.
    5. enable "Config->Automation->Passthrough streams->Subtitle"
    6. enable "Config->Automation->Passthrough streams->Limit audio passthrough/auto add all" and tick the 'English (eng-en)' box in the selection DropBox (if you want to keep other audio tracks, also tick their languages)
    7. enable "Config->Automation->On Load->Always extract timecodes from mp4/mkv/flv files"
    8. enable "Config->Automation->Matroska Settings->Pass-through subtitle default/forced flags" (otherwise the first subtitles will be set as default and the forced subtitle flag will not be used)
    9. enable "Config->Automation->Matroska Settings->Pass-through audio default/forced flags" (probably not needed, since you removed the other languages)
    10. set "Config->Path->Default output path" or enable "Config->Path->Adjust->Output path to source path"
    11. enable "Main->Generate"
    12. drag&drop all the files you want to process onto the input line (Hybrid will then start to analyze the files)
    13. press "Main->Add to Queue"; Hybrid will then create all the necessary jobs for your files
    14. start the processing by pressing "Jobs->Start"


    Cu Selur
    Quote Quote  
  4. Try
    if your mkv contains vid.h264 and aud.ac3,
    enim$ mkvextract tracks "./path/source.mkv" 0:"./path/source-raw-video.h264" 1:"./path/source-raw-audio.ac3"
    you have to specify proper file extensions for extracted raw files.
    Quote Quote  
  5. @Selur Thanks for reply, but output files was exactly the same like the input ones (Hybrid didn't remove any audio track).


    Information about video files:


    file:


    Format : Matroska
    Format version : Version 1
    File size : 261 MiB
    Duration : 24mn 11s
    Overall bit rate mode : Variable
    Overall bit rate : 1 508 Kbps
    Encoded date : UTC 2007-02-11 17:35:16
    Writing application : mkvmerge v1.5.0 ('It's alright, baby') built on Jul 1 2005 10:35:18
    Writing library : libebml v0.7.5 + libmatroska v0.7.7



    video:


    ID : 1
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : High@L5.1
    Format settings, CABAC : Yes
    Format settings, ReFrames : 2 frames
    Codec ID : V_MS/VFW/FOURCC / H264
    Duration : 24mn 11s
    Bit rate : 1 142 Kbps
    Nominal bit rate : 1 230 Kbps
    Width : 704 pixels
    Height : 396 pixels
    Display aspect ratio : 16:9
    Frame rate mode : Constant
    Frame rate : 23.976 fps
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Bits/(Pixel*Frame) : 0.171
    Stream size : 198 MiB (76%)
    Writing library : x264 core 54 rev 600
    Encoding settings : cabac=1 / ref=1 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=5 / brdo=0 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / chroma_qp_offset=0 / slices=1 / nr=0 / decimate=1 / mbaff=0 / bframes=2 / b_pyramid=0 / b_adapt=1 / b_bias=0 / direct=3 / wpredb=1 / bime=0 / keyint=250 / keyint_min=25 / scenecut=40 / rc=abr / bitrate=1230 / ratetol=1.0 / rceq='blurCplx^(1-qComp)' / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / ip_ratio=1.40 / pb_ratio=1.30
    Default : Yes
    Forced : No



    audio:


    ID : 1/2/3
    Format : Vorbis
    Format settings, Floor : 1
    Codec ID : A_VORBIS
    Duration : 24mn 11s
    Bit rate mode : Variable
    Bit rate : 112 Kbps
    Channel(s) : 2 channels
    Sampling rate : 48.0 KHz
    Compression mode : Lossy
    Stream size : 19.4 MiB (7%)
    Writing library : libVorbis 1.0 (UTC 2002-07-17)
    Language : English/English/Japanese
    Default : No
    Forced : No



    and i want Japanese lang only
    Quote Quote  
  6. Strange, should work normally.
    -> need a DebugOutput to see where the problem is, see: http://www.selur.de/support
    Quote Quote  
  7. I added 2 files to queue, here is DebugOutput:
    http://pastebin.com/iQdBW1eF
    Quote Quote  
  8. from the looks of it filtering the language wasn't enabled, will send you a test version which adds some additional debug output
    -> argh, think I found the problem. -> will send you a new test version once I fixed it
    Last edited by Selur; 20th Jan 2014 at 17:14.
    Quote Quote  
  9. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    Another option is ffmpeg

    Code:
    for %a in ("*.mkv") do ffmpeg -i "%a" -map 0:0 -map 0:3 -c:v copy -c:a copy "%~na.new.mkv"
    This will make a copy of a new mkv for each mkv in the folder, with only the video stream and 3rd audio copied, with the suffix "new" appended to the original name. You can change the name or specify output directory if you want and keep the same name

    I don't know of any way of "in place" editing (editing the file in place without making a copy) for this type of manipulation. (mkvpropedit can do inplace editing of some parameters, but not discarding streams)
    Quote Quote  
  10. Ok, Selur fixed smth in his program and everything is fine. Thanks for helping me.Greetings.
    Quote Quote  
  11. Selur's jet speed support gets your requirement rolling.
    alternatively, following shell scripts also works.

    if your mkv contains vid.h264 and audio3.ac3,
    enim$ mkvextract tracks "./path/source.mkv" 0:"./path/source.h264" 3:"./path/source-audio3.ac3"
    enim$ mkvmerge -o "./path/source-video-with-audio-1-n-2-dropped.mkv" "./path/source.h264" "./path/source-audio3.ac3"
    you have to specify proper file extensions for extracted raw files.
    Quote Quote  
  12. problems of the shell script/calls as it is atm.:
    a. fails for vfr mkvs (time codes are not handled)
    b. subtitles and attachments get lost (subtitles are not handled)
    c. only works if the audio and video stream have the same id in each file
    d. get's a lot more complicated if multiple audio streams need to be kept
    e. things might get problematic if the paths and thus the command lines get to long, so the call parameters for mkvmerge&mkvextract would require to be exported to xml parameter files
    Remuxing using mencoder might be a better than using mkvmerge&mkvextract since iirc. mencoder support selecting audio streams by language. (personally I would prefer ffmpeg, but I'm not sure if it allows selecting the audio by language.)
    -> for a batch script to do the whole thing properly it must be a lot more complex

    pro of the script/calls:
    - low requirements

    problem of the solution through Hybrid:
    a. requires to have the tagged audio streams (otherwise manual processing is required)
    b. requires to have Hybrid -> a lot of requirements

    pro of the Hybrid solution:
    - easier to handle and adjust than the script (selecting multiple audiostreams and subtitles is easy when they are tagged)

    Cu Selur
    Quote Quote  
  13. now OP has at least four different methods Hybrid, ffmpeg, mencoder or mkvtoolnix to try.
    and that's why this forum rocks!
    Quote Quote  



Similar Threads