Convert .mkv Files on NAS

DLNA, AirPlay, Chromecast, PS3, XBOX, iTunes, & other media players
Locked
userdisallowed
New here
Posts: 2
Joined: Fri Jan 09, 2015 4:31 am

Convert .mkv Files on NAS

Post by userdisallowed » Fri Jan 09, 2015 4:42 am

Hi

I have 100+ .mkv formated movies on my NAS TS-420 and I'd love to drag them into my iTunes-library (on the NAS).
As you might know, they need to be .mp4. Is it possible to convert them on the NAS itself? Or is there maybe an other way to get them into my iTunes-library?
The only way which I found was to download each file to my mac and then convert it with (for example) handbrake. But that's very tedious...

Thanks you

User avatar
pwilson
Guru
Posts: 22568
Joined: Fri Mar 06, 2009 11:20 am
Location: Victoria, BC, Canada (UTC-08:00)

Re: Convert .mkv Files on NAS

Post by pwilson » Fri Jan 09, 2015 8:21 am

userdisallowed wrote:Hi

I have 100+ .mkv formated movies on my NAS TS-420 and I'd love to drag them into my iTunes-library (on the NAS).
As you might know, they need to be .mp4. Is it possible to convert them on the NAS itself? Or is there maybe an other way to get them into my iTunes-library?
The only way which I found was to download each file to my mac and then convert it with (for example) handbrake. But that's very tedious...

Thanks you


It can be done on the NAS, but with only 0.5GB of RAM, and only a slow 32bit single-core processor on the NAS, I wouldn't want to estimate how my months such a conversion would take.

If you want to convert a directory full of MKV files to MP4 files. You can probably do it with a one-liner right on the NAS (if you can live with the performance hit). Simply login to the NAS via SSH, login as "admin", and then use the following commands:

Code: Select all

cd /share/Multimedia/Movies/{directory you want to convert}/
for i in "$(ls *.mkv)" ; do j=`echo $i | sed 's/.mkv//'` ;  ffmpeg -i "$j.mkv" -vcodec copy -acodec copy "$j.m4a" ; done



This code only converts files in the current directory. It does not recurse into subdirectories...
Maybe try this immediately before going to bed, so you won't care about the performance hit. Check it in the morning.

Your best bet would be to copy them to your unidentified computer device, and convert them using Handbrake there.

Patrick M. Wilson
Victoria, BC Canada
QNAP TS-470 Pro w/ 4 * Western Digital WD30EFRX WD Reds (RAID5) - - Single 8.1TB Storage Pool FW: QTS 4.2.0 Build 20151023 - Kali Linux v1.06 (64bit)
Forums: View My Profile - Search My Posts - View My Photo - View My Location - Top Community Posters
QNAP: Turbo NAS User Manual - QNAP Wiki - QNAP Tutorials - QNAP FAQs

Please review: When you're asking a question, please include the following.

emma24xia
Starting out
Posts: 49
Joined: Thu Dec 04, 2014 11:11 am

Re: Convert .mkv Files on NAS

Post by emma24xia » Fri Jan 23, 2015 1:39 pm

userdisallowed, you are right, iTunes can only accept MP4, M4V and MOV added into its library, no MKV supported. If I were you, I would choose to convert MKV to MP4 before uploading to NAS and them stream into iTunes library for viewing. BTW, I use Pavtube if you would ask.

ohmygeeks
First post
Posts: 1
Joined: Fri Sep 11, 2015 3:42 pm

Re: Convert .mkv Files on NAS

Post by ohmygeeks » Fri Sep 11, 2015 3:47 pm

MKV is a container format and it can not be compatible with some digital devices due to various codecs. In general, MP4 format with H.264/AAC is highly recommended.

User avatar
pwilson
Guru
Posts: 22568
Joined: Fri Mar 06, 2009 11:20 am
Location: Victoria, BC, Canada (UTC-08:00)

Re: Convert .mkv Files on NAS

Post by pwilson » Fri Sep 11, 2015 11:12 pm

ohmygeeks wrote:MKV is a container format and it can not be compatible with some digital devices due to various codecs. In general, MP4 format with H.264/AAC is highly recommended.


Or simply:

Code: Select all

cd /share/Multimedia/Movies/{directory you want to convert}/
for i in "$(ls *.mkv)" ; do j=`echo $i | sed 's/.mkv//'` ;  ffmpeg -i "$j.mkv" -vcodec copy -acodec copy "$j.mp4" ; done
#done


Doing it on a PC is faster. I'd recommend Handbrake for this task. (It's free :DD )

Patrick M. Wilson
Victoria, BC Canada
QNAP TS-470 Pro w/ 4 * Western Digital WD30EFRX WD Reds (RAID5) - - Single 8.1TB Storage Pool FW: QTS 4.2.0 Build 20151023 - Kali Linux v1.06 (64bit)
Forums: View My Profile - Search My Posts - View My Photo - View My Location - Top Community Posters
QNAP: Turbo NAS User Manual - QNAP Wiki - QNAP Tutorials - QNAP FAQs

Please review: When you're asking a question, please include the following.

User avatar
srini
Starting out
Posts: 19
Joined: Sat May 27, 2017 11:02 am

Re: Convert .mkv Files on NAS

Post by srini » Sun Jun 18, 2017 12:43 am

Hi Patrick I
This is my second week figuring out this new toy and I am still figuring out the video issues I have only with .mkv files.

tried this code and get "command not found error" on my TS251+. Logged into SSH from my Mac running OSX via terminal as admin.

cd /share/Multimedia/americangods/
for i in "$(ls *.mkv)" ; do j=`echo $i | sed 's/.mkv//'` ;  ffmpeg -i "$j.mkv" -vcodec copy -acodec copy "$j.mp4" ; done
#done

I was able to see the directory and contents with ls *.mkv

Will appreciate your help.-Thanks!

User avatar
dolbyman
Guru
Posts: 20397
Joined: Sat Feb 12, 2011 2:11 am
Location: Vancouver BC , Canada

Re: Convert .mkv Files on NAS

Post by dolbyman » Sun Jun 18, 2017 12:55 am

Best to open a new thread .. Patrick died almost 2 years ago

in a new thread you can also explain what issues you have with playback

User avatar
srini
Starting out
Posts: 19
Joined: Sat May 27, 2017 11:02 am

Re: Convert .mkv Files on NAS

Post by srini » Sun Jun 18, 2017 6:02 am

Sorry to hear that. He was a real guru !
RIP Patrick !

yokka
First post
Posts: 1
Joined: Mon Apr 06, 2020 2:34 pm

Re: Convert .mkv Files on NAS

Post by yokka » Thu Apr 16, 2020 5:39 pm

Using the command

Code: Select all

ffmpeg -i "$j.mkv" -vcodec copy -acodec copy "$j.mp4"
can create a file *.mp4 but with the same codec source.

Is there a solution to convert mkv (with HEVC codec) into mkv (with codec h264)?

David Morrow
Starting out
Posts: 29
Joined: Tue Feb 21, 2017 10:59 am
Location: Vancouver, Canada

Re: Convert .mkv Files on NAS

Post by David Morrow » Sun Oct 25, 2020 10:51 am

I rip DVD's quite regularly and always first into mkv. I then convert them to mp4 with Handbrake.

You do not need to move the mkv files.

1) Set Handbrake Tools / Preferences / Output Files / Default path: so that the output folder is the same folder where your mkv files reside on your NAS.

2) In Handbrake, on the Source Selection screen, select "Folder".
3) Then, on the main screen, select Add to Queue / Add All.
4) Start encode
It will then spend the next day or two creating new mp4's out of your mkv files.

User avatar
spikemixture
Been there, done that
Posts: 847
Joined: Wed Mar 07, 2018 11:04 pm
Location: 3rd World

Re: Convert .mkv Files on NAS

Post by spikemixture » Sun Oct 25, 2020 11:39 am

rename mymediafile.mkv to mymediafile.mp4.

No conversion needed..

Apple might not like it but windows plays it !!
Qnap TS-1277 1700 (48gb RAM) 6x8TB WD White, 2x8TB WD Red - Raid5, 2x M.2 Crucial 1TB (Raid 1 VM),
2x SSD 860 EVO 500gb (Raid1 QTS), 2x SSD 860 EVO 250GB (Cache), 2x M.2 PCIe 970 500gb NVME (Raid1 Plex and Emby server)
GTX 1050 TI
Qnap TVS-1282 i7 (32GB RAM) 8x10TB WD White - Raid 6, 2x M.2 Crucial 500gb (Raid1 VM),
2x SSD EVO 500gb (Raid1 QTS), 2x SSD EVO 250gb (Raid1 Cache), 2x M.2 PCIe Intel 512GB NVME (Raid1-Servers)
Synology -1817+ - 2x10,2x8,2x6 (Ironwolf) 2x6 (WD Red) - SHR
Drobo 5n - 3x2TB WD Green, 2x3TB WD Red - Drobo Raid
ProBox 8 Bay USB3 - 8x4TB Seagate - JBOD
All software is updated asap.
I give my opinion from my experience i.e. I have (or had) that piece of equipment/software and used it! :roll:

User avatar
OneCD
Ask me anything
Posts: 8056
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: Convert .mkv Files on NAS

Post by OneCD » Sun Oct 25, 2020 12:14 pm

* topic locked to prevent further necroposting *

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage

Locked

Return to “Media Streaming”