Jump to content

Welcome to AnimePassion
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!
Photo

MKV --> MP4 via Batch


  • Please log in to reply
4 replies to this topic

#1
WIRLYWIRLYPOOL

WIRLYWIRLYPOOL

    BakaBakaBaka

  • Members
  • 940 posts
  • 0 thanks
  • Local time: 01:39 PM
  • LocationUnited States

So i got a bunch of MKV's that i want to re-mux into MP4. However, i'm aware that MP4 doesn't support as many codecs as Matroska. The video is fine and doesn't require re-encoding. The real problem is the audio. It varies from FLAC, DTS, AC-3. Therefore, I wanna convert the audio to AAC (Yes even the already lossy AC-3). So basically here is what i want to do...

 

Create a batch file that will extract Video track + All Audio tracks from MKV's with varying names, convert the audio tracks to AAC, and then re-mux it as an MP4.

 

I know it's do-able (I've used ASH's DTS conversion thing) but i'm not sure how to do it. I have yet to TRY anything (It's late and i had a long day) but i wanted to get it out there before i jump into it tomorrow. I'm hoping someone will be able to help me out a bit when creating it. I don't think it'll be that difficult but either way I just wanted some feedback.


Posted Image


#2
JohnFlower

JohnFlower

    Magical Girl

  • VIP
  • 810 posts
  • 39 thanks
  • Local time: 09:39 AM
  • LocationNew Zealand
Using eac3to in demux mode would be the fastest method. You'll get the extra files (like subtitles), but filenames will be predictable and you wont have to worry about track ID's and types like you would with mkvextract.
You could then easily re-encode the audio and remux.

#3
szfzafa

szfzafa

    Meitantei

  • Members
  • 235 posts
  • 333 thanks
  • Local time: 04:39 AM

Agreed with JohnFlower.

 

Mine is like:

"F:\eac3to\eac3to.exe" "W:\[loligeddon] Fate Kaleid Liner Prisma Illya [BD1080p][Batch]\[UTW]_Fate_Kaleid_Liner_Prisma_Ilya_-_OVA_[BD][h264-1080p_FLAC][002240CB].mkv" 2: stdout.wav | "F:\eac3to\qaac.exe" --threading --tvbr 127 --ignorelength --delay -0.021 --quality 2 - -o "W:\[loligeddon] Fate Kaleid Liner Prisma Illya [BD1080p][Batch]\[UTW]_Fate_Kaleid_Liner_Prisma_Ilya_-_OVA_[BD][h264-1080p_FLAC][002240CB]_track2.mp4"

Magical Girls don't age, they just fade away
-- or have their heads bitten off

#4
JohnFlower

JohnFlower

    Magical Girl

  • VIP
  • 810 posts
  • 39 thanks
  • Local time: 09:39 AM
  • LocationNew Zealand
'demux mode' means `eac3to --demux'. It extracts all tracks. What you're doing, szfzafa, would require prior knowledge of track ID's. Obviously getting the varying track ID's + types with mkvinfo and then demuxing with mkvextract would be the best solution*, but using eac3to in demux mode would suffice for the sake of simplicity.

Of course it could also be as simple as szfzafa has pointed out. It would be even easier if it were.


*Not entirely sure if ComSpec or Powershell have the equivalent of `sed' and `grep'... Something to look into I guess.

#5
Tatsu

Tatsu

    Tsundere

  • Members
  • 6 posts
  • 0 thanks
  • Local time: 01:39 PM

I know this is an old thread but someone else may stumble upon it looking for advice on the topic. For this type of operation I prefer ffmpeg.

 

To convert all *.mkv files in the folder you execute the .bat in:

for %%A in (*.mkv) do (
	ffmpeg -i "%%A" -c:v copy -sn -c:a libfdk_aac -vbr 5 -afterburner 1 -movflags +faststart "%%~nA.mp4"
)
@pause

If you also want to downmix audio to 2ch:

for %%A in (*.mkv) do (
	ffmpeg -i "%%A" -c:v copy -sn -ac 2 -c:a libfdk_aac -vbr 5 -afterburner 1 -movflags +faststart "%%~nA.mp4"
)
@pause

And lastly this will create a .bat you can just drag a single video file to and it will run the conversion:

ffmpeg -i %1 -c:v copy -sn -c:a libfdk_aac -vbr 5 -afterburner 1 -movflags +faststart %1.mp4



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users