Ffmpeg Extract Dvd_subtitle From Mkv

Your answer to my threads question worked perfectly. I put -threads 1 just above output.mkv. I'm working with an old 2-core processor and just using 1 thread keeps it from 'cooking'. Also, if anyone else is interested, I found a simple command to convert the mkv to mp4: ffmpeg -i output.mkv -vcodec copy -acodec copy output.mp4. Extract Axiom.FFmpeg.7z to a location of your choice. Run Axiom.exe or create a shortcut on the Desktop. It will automatically detect ffmpeg.exe and ffprobe.exe in the included ffmpeg folder. If you move the ffmpeg folder, set the Windows Environment Variable or specify a path in the Axiom Settings Tab. Add FFmpeg to Environment Variables. FFMPEG Audio Encoder can intake any media file that has audio and encode it to the codec/settings of your choice. You can open video files and or files that is only audio. You can encode with all the following codecs. Currently DTS only supports DTS to core or extract DTS-HD from files that have a DTS track.

- 'How to simply convert MKV to MP4 with FFmpeg?'

- 'FFmpeg converting from MKV to MP4 without re-encoding.'

- 'How to convert MKV to MP4 in terminal?'

Atiker fast system. - 'Convert MKV to MP4 with the output file viewable in the process'

You can see these or those questions asked online about how to use FFmpeg to convert MKV to MP4. Compares with other online MKV to MP4 converters and MKV to MP4 converter freeware, FFmpeg seems different and kind of difficult to handle at the beginning. But do not worry about that, you can read this article to figure out what FFmpeg is and how to convert MKV to MP4 with FFmpeg with ease.

Part 1: How to convert MKV to MP4 using FFmpeg

FFmpeg is the free cross-platform converter that enables you to convert MKV to MP4 and other video formats. And you can use FFmpeg to stream and record media files in free way too. You will not get the common MKV to MP4 interface such as 'Add File' 'Output Format' and other buttons to optimize with. To be more specific, converting .mkv to .mp4 with FFmpeg is faster than common video converters like Audacity, Handbrake and others.

Key Features:

You can decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. And FFmpeg is compatible with Linux, Mac OS, Microsoft Windows and other platforms. There are many FFmpeg tools like ffmpeg, ffserver, ffplay and ffprobe that enable you to manage multimedia files in one-stop. Once you open ffmpeg.org website, you may be shocked with the black-based interface with only one blank to fill with. Just spend one minute to read the following guidance to convert MKV to MP4 with FFmpeg lossless.

How to Convert MKV Videos to MP4 on PC/Mac

Download and install FFmpeg on PC/Mac

Open www.ffmpeg.org to click the huge green 'Download' icon. You can choose FFmpeg versions and which operating system to install including OS X, Windows and Linux mainly.

    Install FFmpeg in Windows:
  • 1. Download FFmpeg Windows package.
  • 2. Right click it and then use 7-Zip to unpack.
  • 3. Open a command prompt with the administrator's rights such as CMD.exe.
  • 4. Run the command: setx /M PATH 'pathtoffmpegbin;%PATH%'.
  • 5. Alter the command so that pathto reflects the folder path from your root to ffmpegbin
    Install FFmpeg in Mac OS X/11:
  • 1. Install homebrew by running the following command on your Terminal.
    $ /usr/bin/ruby -e '$(curl –fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)'
  • 2. Install FFmpeg on Mac computer later and run the command below.
    $ brew install ffmpeg
Step 2

Convert MKV to MP4 from the terminal using FFmpeg on PC/Mac

Find the MKV video you want to convert to MP4. And then you can run the following command to convert a MKV to a MP4 in Terminal.
ffmpeg -i my_movie.mkv -vcodec copy -acodec copy my_movie.mp4

After that, you can get converted MKV to MP4 video lossless on Mac, PC and other platforms for free.

Part 2: Best FFmpeg alternative to convert MKV to MP4

If you still feel hard of understanding the above MKV to MP4 FFmpeg conversion, then you can get another MKV to MP4 converter with easy-to-use interface. It is AnyMP4 Video Converter Ultimate that can batch convert MKV to MP4 with fast conversion speed and highest video quality. The whole interface is well-designed with all kinds of filters displayed simply. And you can get more video-editing filters to customize video settings and video effects of converted MKV to MP4 files on Windows and Mac computers. In a word, Video Converter Ultimate app can satisfy your daily video and audio management, so you do not have to use FFMPEG to convert MKV to MP4 in hassle.

  • • Convert MKV to MP4 and other 200 formats at high speed
  • • Enhance MKV video quality in multi-method automatically to get the best quality
  • • Customize video settings and audio settings
  • • Highly compatible output MP4 videos with most popular digital devices like iPhone X and more
  • • Download and convert YouTube videos to play on portable devices
  • • Convert DVD to various videos and set the 3D settings
  • • Easy to use interface with intuitive design

How to Convert MKV to MP4

Add MKV videos to FFmpeg alternative video converter

You can free download AnyMP4 Video Converter Ultimate from AnyMP4 official site. For Mac users, you need to drag Video Converter Ultimate to the 'Application' folder to complete the FFmpeg alternative app installation. Launch the FFmpeg alternative on Windows or Mac computer. Tap 'Add File' in the toolbar. There will be the popping up window that you can select which MKV video to import.

Step 2

Edit MKV video effect

Tap 'Edit' in the top right corner to enter the MKV video-editing page. You can rotate video, adjust 3D settings, crop video, add video effect, enhance video quality and add watermark mainly. Moreover, you can also choose 'Video Enhance' in the main interface to upscale lower resolution video to higher resolution.

Convert MKV to MP4 with FFmpeg alternative

Select '4K H.265/HEVC Video(*.mp4)' from the drop-down 'Profile' menu. You can tap 'Apply to All' besides to batch convert MKV files to MP4. Click 'Browse' to select any folder to save converted MKV to MP4 video in 'Destination'. It is also supported to merge MKV videos into one MKV file and then convert to MP4. Tap 'Convert' button to start converting MKV videos to MP4 videos on PC or Mac in high quality.

You can choose FFmpeg to convert MKV to MP4 from the terminal. Or you can seek the easier solution to batch convert MKV to MP4 with the Video Converter Ultimate in ultrafast speed. Actually, the latter video converter is more suitable for most users, which has simplified all video conversion processes already.

Part 3: FAQs of using FFmpeg to convert MKV to MP4

Question 1. Why there is a lack of audio after FFmpeg MKV to MP4 conversion? Unlock bolt hydra zte-mf910.

There are 2 reasons for explaining this problem.

➤ The input MKV files has the DTS audio. Though it is supported in MP4, it may do not work with your player. You will have to select the supported audio codec by your player from AC3, MP2, WAV1, WAV2, AAC, Vorbis, MP3 and Opus from FFmpeg conversion.

➤ The FFmpeg is old. You can download the latest FFmpeg to install the audio codec with improvements.

Question 2. How to fix subtitles loss after using FFmpeg to convert MKV to MP4?

There are 2 ways to fix FFmpeg not adding subtitles while converting MKV to MP4.

➤ Add the subtitle as a separate optional track, and it will need your MP4 player (e.g. VLC) to show the subtitle.

Add the following command into FFmpeg:

ffmpeg -i infile.mp4 -i infile.srt -c copy -c:s mov_text outfile.mp4

➤ Add the subtitle as the hard-soft one.

1. Use the libass library to convert the subtitles to .ass format from .srt first by inputting the following command:

ffmpeg -i subtitles.srt subtitles.ass

2. Add the subtitles using a video filter by inputting the following command:

ffmpeg -i mymovie.mp4 -vf ass=subtitles.ass mysubtitledmovie.mp4

Question 3. Which is the best? MP4 or MKV?

Compatibility: MP4 can be played by almost all players while MKV is supported by some devices.

File size: Commonly, MKV has a larger file size than MP4.

Audio track and subtitle support: MKV supports the selectable subtitles of ASS and SSA, and audio tracks, while MP4 does not support. When you want to rip DVD or Blu-ray, MKV is the best choice.

Question 4. How can I convert MKV to MP4 faster?

Lvsim ems crack. AnyMP4 Video Converter Ultimate supports hardware acceleration while converting MKV files. So, you just need to enable the acceleration option to change MKV to MP4 faster.

What do you think of this post?

Excellent

Rating: 4.9 / 5 (172 Votes)

Abstract

Ripping the original byte-for-byte DVD content can be daunting. DVD discs contain 1 GB VOB files while one MPEG file should be the result. Converting to modern formats entail considering many factors, including de-interlacing, quality settings and container choice. Adding chapters to MP4 is doable via MKV. This article helps you on the way.
If you're only interested in the FFmpeg commands, skip right to it: Rip DVD to one file.

Introduction

There is much ripping software to be found on the Internet. With all this competition at least a few DVD rippers should be easy to use and deliver a video file with an exact copy, without any conversion. Unfortunately, many programs do convert the original DVD source, such as Handbrake. Other ripping software includes adware such as OpenCandy, such as Freemake Video Converter. Again, other options, such as AnyDVD, are bloated with many features and come with a steep price tag.
The first objective of this article is simple: take the original VOB files from a DVD, concatenate them and without any conversion put the video and audio stream inside a MP4 (or MKV) container.
The second objective is a bit more complicated: take the newly created MP4 file, deinterlace and convert the video stream to H264, convert the audio stream to AAC, add chapters and save the result in either a MP4 or MKV container where the meta data is located at the start of the file (for web play). That is quite a mouth full.
Especially the the quality issue can be a hassle to figure out: for H264 video there are profiles (e.g. Main, High, High444) to consider, CRF settings (Constant Rate Factor) and deinterlacing that affect perceived quality. Audio quality is affected by choice of codec (e.g. MP3, AAC, AC3) and the used bitrate. Both for audio and video are important to take into account broad device compatibility, retaining perceived quality and file size.
Ripping analogue video material has its own considerations to observe such as composite, S-video and component signalling technologies.
The solution to use should be free, adware free and be simple in use. For conversion is used FFmpeg because of the additional benefits of total control and the ability to deliver consistent automated results. It is true that H265/HEVC is increasingly adopted since two years. However, for broad compatibility and usability on computational less powerful devices H264 is still king.
If you're only interested in the FFmpeg commands, skip right to it: Rip DVD to one file.

Why digitize VHS?

VHS tapes deteriorate over time resulting in data loss. Making subsequent copies of VHS results in generation loss. With each copy or conversion of one format to another, there is loss of quality. VHS tapes have their own unique copying and playback problems concerning quality retention. The video recorder heads physically touch the tape resulting in quality degradation by merely playing tapes. Another problem is that damage to the control track results in tracking problems and thus total signal loss. Apart from these technology-specific issues, degradation of VHS happens over time even when tapes are not used. Problems such as Sticky-shed syndrome is the deterioration of the substance that hold the iron oxide magnetizable coating, which in effect holds the analogue information (i.e. audio, video and tracking information). This may result in total failure of the tape. While temporary solutions exist such as tape backing between 1 and 8 hours up to 60 °C, tape failure is at a critical stage. Degradation speed depend on VHS tape manufacturer, tape lubricant, time, storage temperature and other factors research shows.

Ffmpeg Extract Dvd_subtitle From Mkv Mp4


Below are two video's (click the playlist icon to find the second video). Video 1 is of Roxette - Fading like a flower which consists of 23 generations (source: m1cke1983). The second video is of a guy staged punching another guy with around 65 generations created in 2002 (source: James). Please note that the video recorder quality itself affects the magnitude of generation loss.
Click video to see the degradation between generations:

Why rip DVD's to a harddisk?

Optical disks (such as DVD's) deteriorate over time resulting in data loss. DigitalFfmpeg Extract Dvd_subtitle From Mkv is not synonymous for perfect storage. There are many factors to consider to preserve the original quality of source material. Problems may arise with data storage itself such as Data degradation (= bit rot) in a storage medium. In optical disks such data degradation may be caused by photodegradation in which case light destroys the dye used in the reflective layer of optical discs such as CD's, DVD's and Blu-ray's. However, such data degradation may also occur on hard disks. Luckily, hard disks have the ability to be setup in a RAID configuration which offers the possibility to repair corrupted data.
Concerning the data itself, also with digital sources, re-encoding or transcoding data results in generation loss. With each re-save or conversion of one format to another, there is loss of quality (see image at the right). Transcoding is the process of converting between digital formats. For example, converting from DVD (MPEG2) to Blu-ray (H264/AVC). On the other hand, encoding is the digitization process of converting analogue format, such as VHS tape, to a digital format, such as a MPEG2 file.
While it is true that digital re-saving and transcoding yield much better quality (up to 2000 generations before total loss) than their analogue counterpart (up to 60 generations before total loss), generation loss is inevitable in the end.
Lesson to be learned: keep your original sources! However, because VHS tapes won't last forever, the MPEG2 file will be considered 'original'. Therefore, this first rip is considered crucial concering quality. Ripping from VHS to a file can easily be done with a VHS/DVD recorder combination. As an alternative video can be captured via different cables, including composite, S-video and component.

Composite, S-video, component and SCART

What to consider when digitizing VHS tapes? The most important issue is that legacy storage formats become increasingly more difficult to convert to modern formats as time passes. The reason is that the technology to read legacy formats decreases over time (e.g. VHS recorders). At a certain point in time recovering old video material becomes the art of data archaeology. Data preservation should therefore be a pre-emptive effort. Conversion of VHS tapes into the digital age requires some knowledge of video signalling standards. Common standards in the VHS and DVD age are: Composite, S-video and component. Composite should be avoided because all image information is transported over one channel resulting in considerable loss of video quality. Component separates the Red, Blue and Green signal resulting in superior quality. However, VHS is recorded with comparable quality as the S-video standard. Using component (if you are even able to find a component compatible VHS recorder) would not boost video quality of VHS. SCART is a much used connection on VHS systems. However, the signalling standard used over SCART is not always the same. Be careful to read the video recorder specifications whether S-video is used and not composite to retain video quality.
See the video below:

Rip a DVD to one file

Ripping the original DVD video and audio stream to a MP4 container can be done in one command with FFmpeg: Mkv
ContainerThe MPEG4 container is just a 'box' you can put video and audio streams in. The file extension (e.g. MP4) has no bearing on what video codec was used to encode the video. A MPEG2 video stream fits perfectly in a MPEG4 container. MPEG-4 Part 14 is a widely accepted standard and will be recognised by almost any device.
VIDEO_TS.VOBInclude all VOB files except VIDEO_TS.VOB. Do not rip VIDEO_TS.VOB.
  • -i 'concat:VTS_01_1.VOB|VTS_01_2.VOB|VTS_01_3.VOB' defines the input VOB files. Please note that there may be more or less VOB files located on your DVD disc. Expant the concat command with VTS_01_4.VOB, etc as necessary. A text file that lists the files to be concatenated can be used as well Concat.
  • -target pal-dvd states what the input source material is. Change to ntsc-dvd if your DVD discs are recorded with North American or Japanese DVD recorders.
  • -vcodec copy tells FFmpeg to copy the source video stream, without any conversion (no quality loss!)
  • -acodec copy tells FFmpeg to copy the source audio stream, without any conversion (no quality loss!)
  • OUTPUT_DVD.mp4 Tells FFmpeg to save the video and audio stream in a MP4 container.

Ffmpeg Copy Subtitle

For example, when your DVD drive is drive F: and you want to rip your DVD's to E:rip, the command is as follows: Ripping will take around 7 to 8 minutes at 80fps (1.2MB/sec) at the inner tracks of the DVD and 210 fps (9.1MB/sec) at the outer tracks for 6500kbit/sec video. At lower bitrates (circa 3450kbit/sec) the fps will be as high as 463 at the outer tracks; copying 18.5 seconds of video every second. The output of FFmpeg will look like this: Make sure you include all VOB files, except VIDEO_TS.VOB. In the example below there are five VOB files (excluding VIDEO_TS.VOB)!

Convert interlaced MPEG2 video stream to H264

The command below allows for converting MPEG2 video and AC3 audio to be converted to deinterlaced H264 video with AAC audio. Please note that the input video and audio streams can be of any format. My source material was of the MPEG2 (interlaced) and AC3 format. Deinterlacing improves visual quality. However, because interlacing uses only half the vertical resolution (compared to progressive) some form of interpolation is necessary to give the appearance of progressive video. Nevertheless, perceived quality improves because interlacing artefacts disappear. See the change for yourself:
DeinterlacingRemove '-vf yadif' if your source video stream is not interlaced.
  • -i INPUTFILE.mp4 states the input file (which is the output of the previous section where we created one MPEG4 file with MPEG2 video).
  • -c:v libx264 states that the H264 codec (Advanced Video Codec) must be used. x264 is a FFmpeg implementation of the H264 standard.
  • -preset medium states a sane medium preset. veryfast results in faster transcoding at the cost of bigger files while veryslow results in excruciatingly slow transcoding speeds with smaller file size. However, medium is a sane setting and the file size gains using slow, slower and veryslow are not worth the wait.
  • -profile:v main Many profiles exist. Each profile comes with abilities to increase perceived quality at the cost of computational power. Especially older devices (e.g. iPhone 5S and older) will be able to decode medium profile encodings but have difficulties with higher profiles.
  • -vf yadif makes sure that interlaced video (as is often the case with older VHS recordings) will be deinterlaced.
  • -crf 18 makes sure that no perceived quality loss can be noticed. Sane values are between 18 and 28 with a default at 23. With crf 18 you're serious about perceived video quality.
  • -acodec libvo_aacenc converts the audio stream to AAC 128 kbit/sec audio. Especially, lesser known audio codecs in the original file should be converted to be compatible with a wide range of devices.
  • -movflags +faststart moves the metadata of the MP4 container to the start of the file. Especially handy when the video file will be used in websites. The video can start playing before it has been entirely downloaded which saves time waiting.
  • OUTPUT_H264.mp4 is the output file to which the result will be saved. Again a MP4 container, but now with differently encoded video (not MPEG2 but H264) and audio (not AC3 but AAC) stream.

Add chapters

A nasty problem with ffmpeg is that adding chapters to a mp4 file cannot be done using a text file. However, mkvmerge comes to the rescue. Download mkvtools and mkvmerge will me installed with it. Before we can add the chapters, we need to create afile that contains the timestamps and chapter names, as so:
TimestampsTimestamps are of the format: HH:MM:SS:mmm. HH = hours, MM = minutes, SS = seconds, mmm = milliseconds.
  • INPUT.mp4 is the input file.
  • --chapters chapters.txt contains the chapters in a text file.
  • OUTPUT.mkv is the output file.
Now if we want to have a MP4 file, we need to convert the container from MKV to MP4. This is denoted by the different filename extension.
ContainerChanging container leaves the video, audio and chapter streams untouched.
  • -i INPUT.mkv is the input mkv file of the previous step.
  • -codec copy means: just copy all streams as is; don't convert them.
  • OUTPUT.mp4 is the output file.
Et voila! We have a MP4 file with chapters.

Problem/information: buffer underflow errors

InformationNot really a problem.
The output file plays well without problems. Changing containers or FFmpeg parameters did not solve the problem. Since the output file works without glitches I accept the rip.

Problem/solution: audio channel layout is guessed and results in noise

ProblemAudio channel layout is guessed and results in noise or silence.
FFmpeg shows the output below and the resulting video file contains 'MPEG Audio layer 1/2 (mpga)' and switches between Mono and Stereo channel formats while the sample rate jumps between 44100, 22050 and 11025 Hz (shown in VLC Player).
SolutionFFmpeg is unable to detect the correct DVD LCPM / DVD_PCM format and needs to be forced fed the format pcm_s16be.
The solution is to force feed the audio codec to FFmpeg for DVD audio, if and only if, this problem with auto detection and channel guessing occurs. For testing purposes the audio channels can be individually extracted to test per channel if any audio is available: For much more information about channel mixing and extraction, see the FFmpeg Audio Channel manipulation guide.

PHP script to batch convert video files and include chapters

References

  1. https://www.joeldare.com/wiki/video:rip_a_dvd
  2. http://mso-chronicles.blogspot.nl/2014/08/ripping-dvd-with-ffmpeg.html
  3. Presets: http://dev.beandog.org/x264_preset_reference.html
  4. AAC vs AC3: http://forum.doom9.org/archive/index.php/t-134622.html (Comparable: E-AC3 @ 384, AC3 @ 448 and HE-AAC @ 160kbps )
  5. CRF good values: http://goughlui.com/2016/08/27/video-compression-testing-x264-vs-x265-crf-in-handbrake-0-10-5/
  6. Bowser support AAC and H264 in MP$ container: https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats as good as MP3!
  7. Fast start for web video: https://github.com/mitio/useful-ffmpeg-commands
  8. http://www.ikenvideo.com/Facts-About-Video-Tape-Deterioration
  9. https://www.scancafe.com/image-preservation/videotape-decay
  10. https://www.quora.com/Is-it-true-VHS-tapes-get-fuzzier-every-time-you-play-them
  11. Use either Main Profile (MP) or High Profile (HiP), not ProHiP!: https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC
  12. DVD HSP 1.5 hour (High standard play): between HQ (1 hour) and SP (2 hours): https://www.avforums.com/threads/what-is-xp-sp-lp-ep-slp-and-sep.800549/ , https://www.lifewire.com/dvd-record-modes-and-times-1846582
  13. Adding chapters: http://www.savvyadmin.com/adding-chapters-to-videos-using-mkv-containers/
  14. Saving video meta data 'ffmpeg -i input_video -f ffmetadata metadata.txt' (See: https://stackoverflow.com/questions/9464617/retrieving-and-saving-media-metadata-using-ffmpeg )
  15. Container format comparison: https://en.wikipedia.org/wiki/Comparison_of_video_container_formats
  16. Add thumbnail to video: 'ffmpeg.exe -i D:book.m4b -attach d:book.jpg -metadata:s mimetype='image/jpeg' -metadata:s filename='book-cover.jpg' -c:a opus -b:a 16k 'D:book_with_chapters.mka' https://dbojan.github.io/howto_pc/media,%20How%20to%20add%20chapter%20marks%20to%20audio%20books,%20using%20opus%20codec.htm
  17. Passthrough video/audio (copy-only) options: Avidemux and MKVToolNix
  18. Foudn after article was written: http://makemkv.com/

Article changelog

Remove Subtitles From Mkv Ffmpeg

  • 2018-05-15: Document issued. Views and votes counter activated.