Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
19th February 2010, 18:14 | #1 | Link |
Registered User
Join Date: Jun 2007
Posts: 31
|
mkv to mp4 (h.264+aac+ac3) with video pass-through program?
I'm looking for a program that can convert mkv (h.264+ac3) into mp4 (h.264+aac+ac3). With video pass-through(!) and two audio streams (I need the same audio stream as aac and ac3).
All I have found so far are guides where you have to manually demux the mkv, then use another tool to manually convert the ac3 to aac and then yet another tool to remux the three streams. Or tools that can't convert ac3 into aac or can't add a second audio stream (directly from the mkv source). If anybody knows a program that can do it all (preferably in one step) I would be grateful, since I need to convert quite a few files (DVDs that I converted into mkvs but now my new player doesn't support the container, the streams itself are fine). Thanks! |
19th February 2010, 18:59 | #2 | Link |
Registered User
Join Date: Nov 2009
Posts: 110
|
You might want to look at this batch file that some of the Tivo users are using for MKV to MP4 conversion. It will batch remux a bunch of MKV files to MP4 files, but it won't do the AC3 --> AAC conversion (although you could probably just add it later or update the batch file to do it).
|
19th February 2010, 19:04 | #3 | Link |
Registered User
Join Date: Jun 2002
Location: On thin ice
Posts: 6,846
|
You can also try StaxRip, there is a 'Just Mux' video profile to pass-through video and there is a 'Just Mux' audio profile to pass-through audio.
http://forum.doom9.org/showthread.ph...03#post1375003
__________________
https://github.com/stax76/software-list https://www.youtube.com/@stax76/playlists Last edited by stax76; 19th February 2010 at 19:10. |
27th February 2010, 11:22 | #4 | Link | |
Registered User
Join Date: Jun 2007
Posts: 31
|
Quote:
|
|
27th February 2010, 12:02 | #5 | Link |
Registered User
Join Date: Apr 2008
Posts: 1,181
|
You may take a look at this.
Download the direct264 package as well as ffmpeg(here do not use official ffmpeg builds). Make sure you have mkv splitter and ac3 decoder installed on your system. (e.g. Haali + ffdshow) Use the following command line to do it in one pass: Code:
CTAACEncoder -d -b 128000 -o - input.mkv | ffmpeg -i input.mkv -vcodec copy -acodec copy -sn output.mp4 -i - -acodec copy -newaudio Well official ffmpeg should also do it in one pass: Code:
ffmpeg -i input.mkv -vcodec copy -acodec aac -ab 128 -sn output.mp4 -acodec copy -newaudio 1) The quality of ffmpeg's built-in aac encoder is bad. 2) If your H264 stream contains b-frames, stream copy will fail due to ffmpeg's lack of dts generation for mkv. It is only fixed in my build. |
28th February 2010, 02:10 | #6 | Link | |
Registered User
Join Date: Jun 2007
Posts: 31
|
Quote:
1) Where do I get the CTAACEncoder? I downloaded direct264_20100225.7z but there's no CTAACEncoder, although your link implies that it's included in the package? 2) Can I change the audio stream order since I need the AAC first and AC3 second? 3) official ffmpeg doesn't work for me since my H.264 stream contains b-frames and your ffmpeg can't do aac encoding ("demuxer_muxer only"), did I understand that correct? |
|
28th February 2010, 08:25 | #7 | Link | |||
Registered User
Join Date: Apr 2008
Posts: 1,181
|
Quote:
Quote:
-map 0:0 -map 1:0 -map 0:1 Quote:
|
|||
1st March 2010, 09:15 | #8 | Link | |
Registered User
Join Date: Jun 2007
Posts: 31
|
FYI, I have these strange requirements because I want to be able to play the mkv-to-mp4 video at least on my Computer (AC3), my AppleTV (AAC+AC3) and my iPhone 3GS (AAC), without having to transcode, give up AC3 or the need for multiple versions of the video. And I know the h.264 stream itself is already compatible with all these devices, so...
Quote:
1) Speed. Code:
CTAACEncoder -d -b 128000 -o - h:\input.mkv | ffmpeg -i h:\input.mkv -vcodec copy -acodec copy -s n h:\out3.mp4 -i - -acodec copy -newaudio -map 0:0 -map 1:0 -map 0:1 FFmpeg version SVN-r21997, Copyright (c) 2000-2010 the FFmpeg developers built on Feb 23 2010 22:31:38 with gcc 4.4.1 configuration: libavutil 50. 9. 0 / 50. 9. 0 libavcodec 52.55. 0 / 52.55. 0 libavformat 52.53. 0 / 52.53. 0 libavdevice 52. 2. 0 / 52. 2. 0 libswscale 0.10. 0 / 0.10. 0 [matroska @ 0xbfefe0]Unknown entry 0x80 [matroska @ 0xbfefe0]max_analyze_duration reached [matroska @ 0xbfefe0]Estimating duration from bitrate, this may be inaccurate Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 500.00 (500/1) Input #0, matroska, from 'h:\input.mkv': Duration: 00:10:03.36, start: 0.000000, bitrate: 448 kb/s Stream #0.0(eng): Video: h264, yuv420p, 704x416 [PAR 64:45 DAR 1408:585], PAR 91:64 DAR 77:32, 25 fps, 500 tbr, 1k tbn, 50 tbc Stream #0.1(deu): Audio: 0x0000, 48000 Hz, 5.1, 448 kb/s Decoding audio stream #0 via DirectShow [aac @ 0x10cde60]max_analyze_duration reached [aac @ 0x10cde60]Estimating duration from bitrate, this may be inaccurate Input #1, aac, from 'pipe:': Duration: N/A, bitrate: 125 kb/s Stream #1.0: Audio: aac, 24000 Hz, 2 channels, s16, 125 kb/s Output #0, mp4, to 'h:\out3.mp4': Metadata: encoder : Lavf52.53.0 Stream #0.0(eng): Video: 0x0021, yuv420p, 704x416 [PAR 91:64 DAR 77:32], q=2-31, 50 tbn, 25 tbc Stream #0.1: Audio: 0x0040, 24000 Hz, 2 channels, 125 kb/s Stream #0.2(deu): Audio: 0x00a5, 48000 Hz, 5.1, 448 kb/s Stream mapping: Stream #0.0 -> #0.0 Stream #1.0 -> #0.1 Stream #0.1 -> #0.2 [mp4 @ 0x1478250]st:0 error, non monotone timestamps 1 >= 1 [mp4 @ 0x1478250]st:0 error, non monotone timestamps 2 >= 2 frame=15084 fps= 27 q=-1.0 Lsize= 133547kB time=603.23 bitrate=1813.6kbps video:90807kB audio:42417kB global headers:0kB muxing overhead 0.242225% 2) Since I also want to be able to transfer the video on my iPhone 3GS the file info has to say h.264 level 3.0 or lower or iTunes won't transfer the file, even though the iPhone 3GS itself can play level 3.1 without problems. Luckily I found your post about changing the h.264 bitstream with your modified ffmpeg http://forum.doom9.org/showthread.php?t=152419 So I tried to change the level to 3.0 but somehow it didn't work, mediainfo and iTunes still identify the h.264 stream as level 3.1. Code:
CTAACEncoder -d -b 128000 -o - h:\input.mkv | ffmpeg -i h:\input.mkv -vcodec copy -acodec copy -s n h:\out4.mp4 -i - -acodec copy -newaudio -map 0:0 -map 1:0 -map 0:1 -vbsf h264_changesps=level=30 FFmpeg version SVN-r21997, Copyright (c) 2000-2010 the FFmpeg developers built on Feb 23 2010 22:31:38 with gcc 4.4.1 configuration: libavutil 50. 9. 0 / 50. 9. 0 libavcodec 52.55. 0 / 52.55. 0 libavformat 52.53. 0 / 52.53. 0 libavdevice 52. 2. 0 / 52. 2. 0 libswscale 0.10. 0 / 0.10. 0 [matroska @ 0xa4efe0]Unknown entry 0x80 [matroska @ 0xa4efe0]max_analyze_duration reached [matroska @ 0xa4efe0]Estimating duration from bitrate, this may be inaccurate Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 500.00 (500/1) Input #0, matroska, from 'h:\input.mkv': Duration: 00:10:03.36, start: 0.000000, bitrate: 448 kb/s Stream #0.0(eng): Video: h264, yuv420p, 704x416 [PAR 64:45 DAR 1408:585], PAR 91:64 DAR 77:32, 25 fps, 500 tbr, 1k tbn, 50 tbc Stream #0.1(deu): Audio: 0x0000, 48000 Hz, 5.1, 448 kb/s Decoding audio stream #0 via DirectShow [aac @ 0xf234a0]max_analyze_duration reached [aac @ 0xf234a0]Estimating duration from bitrate, this may be inaccurate Input #1, aac, from 'pipe:': Duration: N/A, bitrate: 125 kb/s Stream #1.0: Audio: aac, 24000 Hz, 2 channels, s16, 125 kb/s Output #0, mp4, to 'h:\out4.mp4': Metadata: encoder : Lavf52.53.0 Stream #0.0(eng): Video: 0x0021, yuv420p, 704x416 [PAR 91:64 DAR 77:32], q=2-31, 50 tbn, 25 tbc Stream #0.1: Audio: 0x0040, 24000 Hz, 2 channels, 125 kb/s Stream #0.2(deu): Audio: 0x00a5, 48000 Hz, 5.1, 448 kb/s Stream mapping: Stream #0.0 -> #0.0 Stream #1.0 -> #0.1 Stream #0.1 -> #0.2 [mp4 @ 0xc50050]st:0 error, non monotone timestamps 1 >= 1 [mp4 @ 0xc50050]st:0 error, non monotone timestamps 2 >= 2 frame=15084 fps= 27 q=-1.0 Lsize= 133547kB time=603.23 bitrate=1813.6kbps video:90807kB audio:42417kB global headers:0kB muxing overhead 0.242225% I really appreciate your help and your fantastic work! PS: If someone knows what additional ffmpeg parameters I need (if possible at all) or what conditions have to be met so that iTunes recognizes both audio streams and shows the audio dialog (where I can chose between the AAC and AC3 audio stream) I would be grateful! Last edited by Mike_111; 1st March 2010 at 09:17. |
|
1st March 2010, 19:04 | #11 | Link | ||
Registered User
Join Date: Jun 2007
Posts: 31
|
Quote:
Quote:
http://forum.doom9.org/showthread.php?t=153105 But that's not exactly my problem since I don't want to reencode my videos. I know and use Handbrake but sadly it doesn't support video passthrough. Which would have been the easiest solution but that's not gonna happen. Requests for the video passthrough feature get shut down for years now, Handbrake just doesn't want to be a demuxer/muxer. Last edited by Mike_111; 1st March 2010 at 19:14. |
||
2nd March 2010, 02:54 | #13 | Link | ||
Registered User
Join Date: Apr 2008
Posts: 1,181
|
Quote:
Quote:
|
||
2nd March 2010, 18:36 | #14 | Link | |
Registered User
Join Date: Jun 2007
Posts: 31
|
Quote:
Sadly this didn't change anything. CPU usage is still just around 5% with 27fps. Anything else I can do or test to get to the bottom of this? Really appreciate your help! Code:
CTAACEncoder -d -mt -b 128000 -o - h:\input.mkv | ffmpeg -i h:\input.mkv -vcodec copy -acodec cop y -vbsf h264_changesps=level=30 -sn h:\out5.mp4 -i - -acodec copy -newaudio -map 0:0 -map 1:0 -map 0:1 FFmpeg version SVN-r21997, Copyright (c) 2000-2010 the FFmpeg developers built on Feb 23 2010 22:31:38 with gcc 4.4.1 configuration: libavutil 50. 9. 0 / 50. 9. 0 libavcodec 52.55. 0 / 52.55. 0 libavformat 52.53. 0 / 52.53. 0 libavdevice 52. 2. 0 / 52. 2. 0 libswscale 0.10. 0 / 0.10. 0 [matroska @ 0xcdefe0]Unknown entry 0x80 [matroska @ 0xcdefe0]max_analyze_duration reached [matroska @ 0xcdefe0]Estimating duration from bitrate, this may be inaccurate Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 500.00 (500/1) Input #0, matroska, from 'h:\input.mkv': Duration: 00:10:03.36, start: 0.000000, bitrate: 448 kb/s Stream #0.0(eng): Video: h264, yuv420p, 704x416 [PAR 64:45 DAR 1408:585], PAR 91:64 DAR 77:32, 25 fps, 500 tbr, 1k tbn, 50 tbc Stream #0.1(deu): Audio: 0x0000, 48000 Hz, 5.1, 448 kb/s Decoding audio stream #0 via DirectShow [aac @ 0xfb34a0]max_analyze_duration reached [aac @ 0xfb34a0]Estimating duration from bitrate, this may be inaccurate Input #1, aac, from 'pipe:': Duration: N/A, bitrate: 125 kb/s Stream #1.0: Audio: aac, 24000 Hz, 2 channels, s16, 125 kb/s Output #0, mp4, to 'h:\out5.mp4': Metadata: encoder : Lavf52.53.0 Stream #0.0(eng): Video: 0x0021, yuv420p, 704x416 [PAR 91:64 DAR 77:32], q=2-31, 50 tbn, 25 tbc Stream #0.1: Audio: 0x0040, 24000 Hz, 2 channels, 125 kb/s Stream #0.2(deu): Audio: 0x00a5, 48000 Hz, 5.1, 448 kb/s Stream mapping: Stream #0.0 -> #0.0 Stream #1.0 -> #0.1 Stream #0.1 -> #0.2 [mp4 @ 0xce0050]st:0 error, non monotone timestamps 1 >= 1 [mp4 @ 0xce0050]st:0 error, non monotone timestamps 2 >= 2 frame=15084 fps= 27 q=-1.0 Lsize= 133547kB time=603.23 bitrate=1813.6kbps video:90807kB audio:42417kB global headers:0kB muxing overhead 0.242225% |
|
2nd March 2010, 18:45 | #15 | Link |
Registered User
Join Date: Apr 2008
Posts: 1,181
|
OK I did a test on a similar file and it gave me ~300fps and ~70% CPU load on my 1.8G Turion X2.
What demuxer and decoder are you using? Try running "CTAACEncoder -d -mt -b 128000 -o NUL h:\input.mkv" and tell me your encoding speed and CPU usage. |
2nd March 2010, 20:42 | #16 | Link | ||
Registered User
Join Date: Jun 2007
Posts: 31
|
Quote:
Quote:
Code:
CTAACEncoder -d -mt -b 128000 -o NUL h:\input.mkv Decoding audio stream #0 via DirectShow h:\input.mkv --> NUL 603 seconds processed Encoding finished |
||
3rd March 2010, 03:02 | #17 | Link |
Registered User
Join Date: Apr 2008
Posts: 1,181
|
Strange. I was also using Haali + ffdshow. Is the encoding speed same as playback speed?
I guess it could be one of the following reasons: 1) HDD read becomes bottleneck.(Your source bitrate is too high) 2) Demuxer or decoder has limited maximum decoding speed to playback speed. Try switching to MPC Matroska Splitter(MatroskaSplitter.ax in MPC-HC's standalone filters). |
Thread Tools | Search this Thread |
Display Modes | |
|
|