mkv to mp4?

Sep 15, 2013 at 9:48 PM
I am using MCE Buddy 2.3.11

Anyone have a profile for transcoding mkv to mp4 (simply repackage, or copy Video and make Audio Stereo, AC3, or AAC)?

Thanks
Coordinator
Sep 16, 2013 at 12:59 PM
Try using the TS Unprocesssed ot TS profile as a base and change the ext to MP4.

If you are looking to change without remuxing to TS then refer to the forum on WTV and H264 thread which will allow you to keep the H264 without changing to MPEG2 and then use the above customized profile.

Cannot say if it'll work on 2.3.11 but should work on 2.3.12 or later.

Marked as answer by rboy1 on 1/29/2014 at 9:11 AM
Coordinator
Sep 17, 2013 at 1:31 PM
HEre's the profiles for 2.3.12 or later:
[MP4 Unprocessed]
Description=Creates MP4 files by copying the video directly. It does not resize, remove black bars, deinterlace your videos or select audio language. Use this if you have high quality HD recordings which don't need processing.
order=copy,ffmpeg
copy-remuxto=.mp4
copy-audiodelay=skip
ffmpeg-general=-threads 0
ffmpeg-video=-ss 3 -vcodec copy -map 0:a -map 0:v
ffmpeg-audio=-acodec copy
ffmpeg-audioac3=-acodec copy
ffmpeg-ext=.mp4
ffmpeg-audiodelay=skip
FixedResolution=true
SkipCropping=true
AllowH264CopyRemuxing=true
Sep 18, 2013 at 1:47 AM
Thanks for your help rboy1. I saw some differences between 2.3.11 and 2.3.12

2.3.11 works when outputting a .m4v file

2.3.12 only works when outputting a .mp4 file

This is the profile that got the job done and works on the Apple TV3 as AC3 or other audio tracks had no sound on the apple tv.
[MKV to MP4 for Apple TV3 (AAC)v2.3.12]
Description=Used to convert MKV to MP4 files by copying the video directly, and converting the audio track to AAC 2Ch.
order=ffmpeg
ffmpeg-general=-threads 0
ffmpeg-video=-ss 3 -vcodec copy -map 0:a -map 0:v
ffmpeg-audio=-acodec libvo_aacenc -ab 384k
ffmpeg-audioac3=-acodec libvo_aacenc -ab 384k
ffmpeg-ext=.mp4
ffmpeg-audiodelay=skip
FixedResolution=true
SkipCropping=true
AllowH264CopyRemuxing=true
Coordinator
Sep 18, 2013 at 2:12 AM
great glad to hear. I didnn't understand wha tyou meant by

2.3.12 only works when outputting a .mp4 file


Sep 18, 2013 at 2:28 AM
In MCEBuddy v2.3.12 when I set the profile to

ffmpeg-ext=.m4v It would not output a file. Once I changed to ffmpeg-ext=.mp4 it worked fine.

Maybe something else I was doing wrong?

Either way, got it working great now.

Thanks
Coordinator
Sep 18, 2013 at 1:37 PM
Format issues, there are subtle issues which is why ffmpeg is not able to always convert to m4v instead of mp4 but they 100% compatible.
The answer is very simple, add this line to your profile
RenameExt=.m4v
Coordinator
Sep 18, 2013 at 1:38 PM
BTW .m4v profile works fine 2.3.14
Oct 21, 2013 at 5:29 PM
I upgraded to 2.3.14 on Saturday. TS to m4v conversion is working fine. However when I try to use the following profile to convert mkv to m4v there are a few problems:
[MP4 Unprocessed]
order=ffmpeg
ffmpeg-general=-threads 0
ffmpeg-video=-ss 3 -vcodec copy
ffmpeg-audio=-acodec copy
ffmpeg-audioac3=-acodec copy
ffmpeg-ext=.mp4
ffmpeg-audiodelay=skip
PreConversionCommercialRemover=true
FixedResolution=true
SkipCropping=true
First, if I use ffmpeg-ext=.m4v the conversion fails. This is similar to what I saw in 2.3.12. Link to the log in my dropbox below.
https://dl.dropboxusercontent.com/u/1124654/MKV%20to%20M4V-2013-10-21T07-44-40.2034753-05-00.log

Secondly, if I use ffmpeg-ext=.mp4 the conversion works, but the file size is much larger than the original (original= 1.57G - converted= 2.29G) which does not make sense. Link to the log in my dropbox below.
https://dl.dropboxusercontent.com/u/1124654/MKV%20to%20MP4-2013-10-21T11-30-47.9325050-05-00.log
Coordinator
Oct 21, 2013 at 7:33 PM
Both your issues are happening because ffmpeg is not able to extract the H264 video from your MKV file:

2013-10-21T11:31:52 MCEBuddy.AppWrapper.FFmpeg --> [mpegts @ 00000000036aaa20] H.264 bitstream malformed, no startcode found, use the h264_mp4toannexb bitstream filter (-bsf h264_mp4toannexb)

it ends up remuxing it to mpeg2video. So
  1. It's larger which is what you're seeing
  2. m4v does not support mpeg2video so the conversions fails
Can you upload the original MKV file to the mcebuddy server I'll need to look into it further to see what's going on.
Oct 22, 2013 at 12:45 AM
I uploaded a folder "mkv to mp4 Forum Discussion" to the server with a video and it's log. I have tried it on 3 separate files now, does it to all of them.

Saw same issue in 2.3.12. So whatever happened to ffmpeg from then on seems to be the issue.

I am using an apple tv which sucks, so I need the files to be h.264 or they won't play. Do you think this is a quick fix or should I just downgrade back to 2.3.11?

Thanks
Coordinator
Oct 22, 2013 at 1:10 AM
Are you saying this profile worked with 2.3.11?


Coordinator
Oct 22, 2013 at 1:19 AM
Edited Oct 22, 2013 at 1:26 AM
Thanks for reporting this, found the issue.
For now I have a very simple fix for you (I'll put a more detailed fix in the next release).

Open your mcebuddy.conf, in the FFMPEG Backup Remux section, replace the entire section with this:
[FFMpegBackupRemux]
CopyRemux0=-ss 2 -i <source> -vcodec copy -acodec copy -map 0:a -map 0:v -bsf h264_mp4toannexb -f mpegts
SlowRemux0=-ss 2 -i <source> -vcodec mpeg2video -qscale 0 -r auto -acodec copy -map 0:a -map 0:v -f mpegts
SlowRemux1=-ss 2 -i <source> -vcodec mpeg2video -qscale 0 -r auto -acodec ac3 -ab 384k -map 0:a -map 0:v -f mpegts
RemuxDropThreshold=3.0
RemuxDuplicateThreshold=3.0
They key was to introduce -bsf h264_mp4toannexb which is why the H264 copy remuxing was failing.
Coordinator
Oct 22, 2013 at 1:26 AM
Whoops check my last post again, I editing the profile, only the 1st line should contain it.
Oct 22, 2013 at 1:31 AM
In 2.3.11 this profile worked flawlessly
[MKV to M4V for Apple TV3 (AC3)v2.3.11]
Description=Used to convert MKV to MP4 files by copying the video directly, and copying the audio track.
order=ffmpeg
ffmpeg-general=-threads 0
ffmpeg-video=-ss 3 -vcodec copy -map 0:a -map 0:v
ffmpeg-audio=-acodec copy
ffmpeg-audioac3=-acodec copy
ffmpeg-ext=.m4v
ffmpeg-audiodelay=skip
FixedResolution=true
SkipCropping=true
AllowH264CopyRemuxing=true
I will try the fix you said and let you know. By whoops, edited now. Is the code box from your 8:26 post correct now, or do i need to change something?
Coordinator
Oct 22, 2013 at 2:30 AM
it's correct now, only the copyremux0 line should have the -bsf addition to it.


Oct 22, 2013 at 3:03 AM
I copied the top line over and that seemed to do the trick on a test file. Thanks for the quick response.
Coordinator
Oct 22, 2013 at 4:32 PM
I've put a more comprehensive and better check for this condition (and other similar bitstream related conditions in the next build of MCEBuddy).

Download and try it once it's out