Media Transfer Protocol
|This article relies too much on references to primary sources. (February 2013)|
The Media Transfer Protocol (MTP) is an extension to the Picture Transfer Protocol (PTP) communications protocol that allows media files to be transferred atomically to and from portable devices. Whereas PTP was designed for downloading photographs from digital cameras, Media Transfer Protocol allows the transfer of music files on digital audio players and media files on portable media players, as well as personal information on personal digital assistants. MTP is a key part of WMDRM10-PD, a digital rights management (DRM) service for the Windows Media platform.
MTP is part of the "Windows Media" framework and thus closely related to Windows Media Player. Versions of the Microsoft Windows operating system from Windows XP SP2 support MTP. Windows XP requires Windows Media Player 10 or higher; later Windows versions have built-in support. Microsoft has also made available an MTP Porting Kit for older versions of Windows back to Windows 98.
The USB Implementers Forum device working group standardised MTP as a full-fledged Universal Serial Bus (USB) device class in May 2008. Since then MTP is an official extension to PTP and shares the same class code.
The main purpose of this protocol is to allow only the transfer of media files and associated metadata to and from portable devices, one transfer function, in or out, at a time. It does not support operations such as open, edit and modify. A workaround is to copy to the hosting system for these operations and then copy back.
The protocol was originally implemented for use across USB but extended for use across TCP/IP and Bluetooth. Windows Vista supports MTP over TCP/IP. Windows 7 and Windows Vista with the Platform Update for Windows Vista also support MTP over Bluetooth. The host connecting to an MTP device is called an MTP Initiator whereas the device itself is an MTP Responder.
A main reason for using MTP rather than, for example, the USB mass-storage device class (MSC) is that the latter operates at the granularity of a mass storage device block (usually in practice, a FAT block), rather than at the logical file level. In other words, the USB mass storage class is designed to give a host computer undifferentiated access to bulk mass storage, such as compact flash, rather than to a file system, which might be safely shared with the target device (except for specific files which the host might be modifying/accessing). In practice, therefore, when a USB host computer has mounted an MSC partition, it assumes absolute control of the storage, which then may not be safely modified by the device without risk of data corruption until the host computer has severed the connection. Furthermore, because the host computer has full control over the connected storage device, there is a risk that the host computer may corrupt the file system, reformat it to a file system not supported by the USB device, or otherwise modify it in such a way that the USB device cannot completely understand it.
MTP and PTP specifically overcome this issue by making the unit of managed storage a local file rather than an entire (possibly very large) unit of mass storage at the block level. In this way, MTP works like a transactional file system - either the entire file is written/read or nothing. The storage media is not affected by failed transfers.
Where the device maintains a database/index of the content of the disk, MTP saves the cost of re-scanning the entire disk every time the content is modified.
Additionally, the MTP allows MTP Initiators to identify the specific capabilities of device(s) with respect to file formats and functionality. In particular, MTP Initiators may have to provide passwords and other information to unlock files, or otherwise enable digital rights management. Nothing specific of this nature is in the core standard but the features are available via vendor extensions. MTPZ, the Zune Extension to MTP specifically denies access to files until authentication has been processed, which is only possible using Windows Media Player 10 or higher.
Supported file formats
The MTP specification includes an enumeration of file formats, called object format. The use of this enumeration is in communicating supported file formats, and formats of transferred files. Apart from some uncategorized formats in the beginning, the list of formats is grouped in categories of image, audio, video and document formats, with each category having one "Undefined" format followed by specific formats. There is also a super-generic "Undefined object" format.
Jolla cited lack of WebM support in MTP as one reason not to support the video format in their mobile operating system Sailfish OS. It is unclear if the limitation is in the tools or the spec, other than that WebM is not defined by the MTP 1.1 spec.
MTP allows no parallelism, unlike USB mass storage or NAS. MTP has been built to only allow a single operation at a time (for example, read, write or delete operation), while no other operation can be executed until the previous operation is complete.
By design, MTP devices (like PTP devices) are not treated as a traditional removable drive. The actual file system is implemented by the device, and not by the computer's operating system. This also means that file system recovery tools on the computer will be of no use. In addition, most other programs on the computer will not recognise the MTP device, limiting the user to software from the device manufacturer or other MTP specific programs.
Antivirus/antimalware programs of the host computer/device can not access the MTP device and so MTP devices can act as intermediate hosts/vectors for viruses and malware.
When opening a file, the user must wait until the file is copied to the host computer/device before it can be viewed; the file remains on the host computer's storage after viewing and after removal of the device.
Devices that are limited to MTP transfers do not allow or support instant access or multitasking.
The MTP and PTP standards do not support direct modification of objects. Modified objects must be copied out of the device and reuploaded in their entirety, which can take a long time for large objects. Google's MTP implementation in Android includes extensions to deal with this limitation; however, these extensions must be supported by the host operating system, and are not available by default. This blocks the direct creation of files on the device from the host computer; files must be first created on the host computer and then copied over.
As of 2013[update], MTP is much less widely supported than USB mass storage; see the MTP support section for more details. MTP also lacks corporate support, as a growing number of companies block MTP because of the requirement to automatically copy and write files (including potential malware etc.) to the host machine, instead of opening directly from the device.
MTP is supported in Windows XP if Windows Media Player 10 or later versions are installed. Windows Vista and later have MTP support built in. For older versions of Windows, specifically, Windows 2000, Windows 98 and Windows Me, Microsoft has released the MTP Porting Kit. which contains a MTP device driver. Some manufacturers, such as Creative Technology, also provide legacy MTP drivers for some of their players; these usually consist of MTP Porting Kit files with a customized INF file describing their specific players.
Most MTP-compatible devices are not assigned drive letters; instead, they appear as "devices" in applications such as Windows Explorer. Under Windows, MTP-compatible devices support a feature called AutoSync, which lets users configure Windows Media Player to automatically transfer all copied or newly acquired content to devices whenever they are connected - provided that content is compatible with Windows Media player. AutoSync is customizable so that the player will transfer only content that meets certain criteria (songs rated four stars or higher, for instance). Changes made to file properties (such as a user rating) on a device can be propagated back to the computer when the device is reconnected. Windows 7's sensor platform supports sensors built into MTP-compatible devices.
Copies of files accessed over MTP may remain on the host computer even after reboot, where they will be accessible to the user account which accessed them, as well as any other user accounts able to read that user account's files, including any administrative users.
Linux and other Unix-like systems
MTP has been implemented in libmtp. Proper support was added to GVFS in version 1.15.2 (2013-01-15) by Philip Langdale. This gives GNOME desktop apps like Nautilus and file-roller the ability to access files on an MTP device. Early patches for GVFS to enable Google's direct I/O extensions are available. The KDE Project develops MTP KIO Slave with similar level of integration as GVFS. The tool does not seem to be as developed, as the Gnome implementation as of October 2014.
A standalone graphical tool is gMTP.
There are several other Linux tools for accessing MTP devices in other desktop environments and from the commandline. For example, Ubuntu 12.10 and higher has MTP support, while a workaround is available for older versions.
The mtpfs tool is a FUSE based file system allowing to mount MTP devices under normal Unix filesystem hierarchy, allowing it to be accessible by any program operating on file system. Directory listening, renaming, deleting, getting file attributes, copying files back and forth, and caching is supported. Similar tools with differing implementations and licences are jMTPFS, go-mtpfs and simple-mtpfs.
Apple OS X
OS X has built-in support for MTP (through the application "Digital Images") but no (third-party) drivers to mount MTP devices as drives. Also several third-party file transfer applications are available for Mac OS X 10.5 and later:
- Android File Transfer is a simple MTP client.
- XNJB also offers syncing of iTunes playlists.
- SyncMate Expert claims to also support MTP besides other synchronization tasks. The support can't be tested in the free version.
Companies, including Creative Technology, Intel, iriver and Samsung, that manufacture devices based on Microsoft's "Portable Media Center specification", have widely adopted MTP. Supporting devices were introduced at the 2004 Consumer Electronics Show.
After an initial period of uncertain reactions, several large media player producers such as Creative Technology and iriver adopted the MTP protocol in place of their own protocols.
Many devices and audio software applications support MTP. Later versions of several operating systems, including AmigaOS, Android, AROS, Linux, and MorphOS, Symbian OS support MTP, sometimes with additional drivers or software.
- Media Transfer Protocol Implementation Details. MTP defined in slide 3
- Final Availability of Windows Media Player 10 Brings More Music and More Choices to Music Fans
- MTP, Portable Player Standard: Create Digital Music blog
- MTP Specification 1.1 on USB.org
- MTP Over Various Transports
- MTP Specification
- Normal file read/write support with the GVFS MTP backend!
- hanwen/go-mtpfs/blob/master/mtp/android.go on GitHub
- MTP Porting Kit
- Sensors and Windows - Windows Portable Devices Team Blog, MSDN 17 Dec 09
- "libmtp". Libmtp.sourceforge.net. Retrieved 2014-03-15.
- "gvfs-1.15.2.changes". ftp.gnome.org. 2013-01-15. Retrieved 2013-06-06.
- Native gvfs backend for MTP devices
- git commit adding MTP backend to gvfs
- Bug 695984 – Add support for Android direct I/O extensions
- ArchLinux Wiki: MTP
- Joey-Elijah Sneddon (2013-06-14). "How To Mount The Google Nexus 4 on Ubuntu". OMG! Ubuntu!. Retrieved 2014-03-15.
- Arch Linux Wiki (2014-09-01). "MTP". Retrieved 2014-10-23.
- "Android.com". Android.com. Retrieved 2014-03-15.
- "XNJB". Richard Low. Retrieved 2014-06-15.
- "SyncMate". ELTIMA software. Retrieved 2014-06-15.