LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-27-2017, 02:21 PM   #1
alhatmy
LQ Newbie
 
Registered: Jun 2017
Posts: 2

Rep: Reputation: Disabled
Help: Batch convert from MKV & embed subtitles to MP4


I'm new with Linux commands, please help ...

I have folders that are full with (Mkv) files that got some subtitles inside it, srt or ass ..
I need a command that can transfer all files inside this folder from mkv to mp4 (along with hard sub for embed subtitle)

so the result will be mp4 in same quality .. same name .. with the subtitle

please ..
 
Old 06-27-2017, 02:25 PM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
you can probably create a script using h264enc.
 
Old 06-27-2017, 03:10 PM   #3
alhatmy
LQ Newbie
 
Registered: Jun 2017
Posts: 2

Original Poster
Rep: Reputation: Disabled
any help please .. ?

creating script using h264enc ..
 
Old 06-27-2017, 04:03 PM   #4
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
I have done similar things with ffmpeg. Often you do it as a one-line using find -exec or you can put it in a script.
 
Old 06-27-2017, 04:41 PM   #5
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,137
Blog Entries: 6

Rep: Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826
Quote:
I need a command that can transfer all files inside this folder from mkv to mp4 (along with hard sub for embed subtitle)
Copy audio and video to output with change in container.
Code:
ffmpeg -i file.mkv -c:a copy -c:v copy file.mp4
Loop through all .mkv files in directory.
Code:
for i in *.mkv; do 
    echo $i
done
As for subs there are several ways to do it. Look at man ffmpeg

Hard subs in the video itself? You'll need to specify the sub file and then overlay it onto the video.

Example: Overlay dvd_subs onto video (1st vid stream, 2nd audio stream, 2nd sub stream)
Code:
ffmpeg -probesize 1000000000 -analyzeduration 100000000 -i movie.vob -filter_complex "[0:0][0:4]overlay[0]" -map [0] -map 0:2 -c:a copy -c:v libx264 -b:v 2500k movie.avi
If you already have sub files along with the .mkv files, then read the man page for a while and understand how to do what you want.

If you will do a search for this on LQ there are lots of questions on this answered.
 
1 members found this post helpful.
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Batch convert/embed subtitles ffmpeg Rhadamanthysan Linux - Software 5 12-09-2019 07:55 AM
[SOLVED] Convert mkv to mp4 in terminal - how? gael33 Linux - Newbie 13 11-30-2015 03:42 PM
Transcoding MKV files with embedded subtitles to MP4's with 'burned in' subtitles TB0ne LinuxQuestions.org Member Success Stories 0 09-17-2014 11:45 AM
Convert mkv to mp4 to play on PS3 ? robertpolson Linux - General 1 09-11-2007 03:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration