Script to change mkv container to mp4
Script to change mkv container to mp4
Hi, I am using iSabnzbd to download nzbs directly on to my iPad, mainly mkv movies!
I would like an add on script that quickly changes an mkv contained movie in to an mp4 ready to be played directly on the iPad! The script could use ffmpeg video converter from Cydia! Not sure about the audio side of things probably best to just leave it as is! Pyphon would be ok or unix I guess!?
I use SabMobileHD as a front end (Client) using localhost and it has the option to enable a script per download so would love to just tick convert mkv2mp4 and then as soon as its finished downloading the container is changed to mp4 and of I go with the native video player :-)
Any help appreciated, thanks.
Matt
I would like an add on script that quickly changes an mkv contained movie in to an mp4 ready to be played directly on the iPad! The script could use ffmpeg video converter from Cydia! Not sure about the audio side of things probably best to just leave it as is! Pyphon would be ok or unix I guess!?
I use SabMobileHD as a front end (Client) using localhost and it has the option to enable a script per download so would love to just tick convert mkv2mp4 and then as soon as its finished downloading the container is changed to mp4 and of I go with the native video player :-)
Any help appreciated, thanks.
Matt
Re: Script to change mkv container to mp4
How about
Disclaimer: not used by me.
Code: Select all
ffmpeg -i blabla.mkv blabla.mp4
Re: Script to change mkv container to mp4
Can't be as simple as that surely lol... Anyway if im going to use said script as a sabnzbd ad on, to use on every download on the fly I can't input file names manually! This script will auto run after sabnzbd has finished all it's other business so it needs to recognise mkvs with any file name!?
New to all this so if I'm a bit off please forgive me lol
New to all this so if I'm a bit off please forgive me lol
Re: Script to change mkv container to mp4
Anyone? I know you super nerds are here somewhere with your magical powers :-) lol
Re: Script to change mkv container to mp4
You cant have manual and automatic ?Mattoligy wrote: I can't input file names manually!
Re: Script to change mkv container to mp4
I want it to use ffmpeg from cydia (As this is the only conversion library on ios) to just remux/change the container from MKV to MP4 without touching the audio, i assume the audio doesn't need touching!? Most movies are in h/x.264 so i would like to keep it like that and just change the container!
Along these lines...
1) change *.mkv to input.mkv
2) move input.mkv to where ever ffpmeg needs it (If it needs to be in a specific location)
3) change container from mkv to mp4 leaving audio alone (Passthrough)
4) change input.mkv back to original movie filename (Either from .nzb file or ideally from containing folder name)
Along these lines...
1) change *.mkv to input.mkv
2) move input.mkv to where ever ffpmeg needs it (If it needs to be in a specific location)
3) change container from mkv to mp4 leaving audio alone (Passthrough)
4) change input.mkv back to original movie filename (Either from .nzb file or ideally from containing folder name)
Re: Script to change mkv container to mp4
Well, it is: see below the conversion of a .mkv into a .mp4 on a Ubuntu system:Mattoligy wrote:Can't be as simple as that surely lol...
Code: Select all
sander@ubuntu1004:~/downloads$ time ffmpeg -i some-clip.mkv some-clip.mp4
FFmpeg version SVN-r0.5.9-4:0.5.9-0ubuntu0.10.04.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --extra-version=4:0.5.9-0ubuntu0.10.04.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 1 / 52.20. 1
libavformat 52.31. 0 / 52.31. 0
libavdevice 52. 1. 0 / 52. 1. 0
libavfilter 0. 4. 0 / 0. 4. 0
libswscale 0. 7. 1 / 0. 7. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Jun 12 2012 16:27:34, gcc: 4.4.3
Seems stream 0 codec frame rate differs from container frame rate: 47.95 (48000/1001) -> 23.98 (24000/1001)
Input #0, matroska, from 'some-clip.mkv':
Duration: 00:01:01.31, start: 0.000000, bitrate: N/A
Stream #0.0(eng): Video: h264, yuv420p, 1920x800, PAR 1:1 DAR 12:5, 23.98 tbr, 1k tbn, 47.95 tbc
Stream #0.1(ger): Audio: dca, 48000 Hz, 5.1, s16
Stream #0.2(eng): Audio: dca, 48000 Hz, 5.1, s16
Stream #0.3(ger): Subtitle: 0x0000
Output #0, mp4, to 'some-clip.mp4':
Stream #0.0(eng): Video: mpeg4, yuv420p, 1920x800 [PAR 1:1 DAR 12:5], q=2-31, 200 kb/s, 90k tbn, 23.98 tbc
Stream #0.1(ger): Audio: libfaac, 48000 Hz, 5.1, s16, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 1366 fps= 17 q=31.0 Lsize= 6921kB time=61.18 bitrate= 926.7kbits/s
video:5825kB audio:1061kB global headers:0kB muxing overhead 0.505222%
real 1m21.494s
user 1m2.628s
sys 0m0.820s
sander@ubuntu1004:~/downloads$
- the resulting .mp4 is a few times smaller than the source .mkv. So it's not just a matter of changing the container
- this is on Ubuntu. I had to install a medibuntu repository to get it working with the codec.
- within my virtual machine (which is not too fast), the conversion is about 'real time', which sounds good, but means the conversion of a 1 minute clip takes about 1 minute. So I guess it won't be fast either on an ARM based iPad.
- I haven't got a iPad, so I can't help you with iPad scripting.
Re: Script to change mkv container to mp4
Everywhere I have researched online so far people say it is extremely quick to just re mux!?
Re: Script to change mkv container to mp4
Well, ask those people then!Mattoligy wrote:Everywhere I have researched online so far people say it is extremely quick to just re mux!?
Re: Script to change mkv container to mp4
Didn't mean that to sound like it sounded
Uv been really helpful and i am grateful for any help at all, so thanks :-)
Uv been really helpful and i am grateful for any help at all, so thanks :-)
Re: Script to change mkv container to mp4
try
ffmpeg -i input.mkv -vcodec copy -acodec aac -sameq output.mp4
That should be faster
ffmpeg -i input.mkv -vcodec copy -acodec aac -sameq output.mp4
That should be faster
Re: Script to change mkv container to mp4
*snicker* Gotta love the appreciation sometimes eh? Just a Note, your Advice helped me, so know it was not a waste, Thank you Sander!sander wrote:Well, ask those people then!
Re: Script to change mkv container to mp4
Hey Sander, your suggestion works perfectly but it re encodes the whole film, which takes hours! The option including -vcodec copy however doesn't work for just changing container, it errors out and only produces an output file of a few kb...
http://cl.ly/image/0D2O0i0P161T
http://cl.ly/image/0D2O0i0P161T
Re: Script to change mkv container to mp4
try
if that doesnt work try adding -an and -vn separately and then together
Code: Select all
ffmpeg -i input.mkv -vcodec copy -acodec libfaac -aq 200 output.mp4
Re: Script to change mkv container to mp4
apparently its a known bug if they dont fix it
Work around is making a full copy (copy both audio and video codecs keeping the container) and then run my command on the output from the first. Not great with space though ..
or update to the svn release - which may be hard
Work around is making a full copy (copy both audio and video codecs keeping the container) and then run my command on the output from the first. Not great with space though ..
or update to the svn release - which may be hard