Media Transfer Protocol

From Wikipedia, the free encyclopedia
Jump to: navigation, search

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.[1] 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,[1] 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;[2] 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.[3] Since then MTP is an official extension to PTP and shares the same class code.[4]


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.[5] The host connecting to an MTP device is called an MTP Initiator whereas the device itself is an MTP Responder.[6]

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.

Comparison with USB Mass Storage[edit]

File oriented instead of block oriented protocol[edit]

By not exposing the filesystem and metadata index, the integrity of these is in full control of the device.

  • No risk of filesystem corruption if unplugging the device during a transfer (atomic file transfers)
  • Inclusion of metadata with the transfer makes re-indexing after unplugging unnecessary.
  • The host does not need to support the filesystem of the device. Conversely, the device manufacturer is free to choose a filesystem other than the widely supported FAT family of filesystems.
  • Filesystem recovery and undeletion tools on the computer can not be used.


  • 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.
  • Limited support for transferring parts of files, such as blocks or byte ranges (see #Direct modification and partial transfer features).
  • Limited support for direct modification of files (see #Direct modification and partial transfer features). To modify a file or its metadata, the whole file may need to be copied out of the device and reuploaded, which takes a long time for a large file or directory, and blocks the device for other operations in the meantime. Google's MTP implementation in Android includes extensions to deal with this limitation; however, these extensions must be supported by the host operating system.[7][8]

Transparency to MTP unaware software[edit]

Unless the operating system exposes the MTP device as a virtual file system, MTP unaware software will not be able to make use of the device, limiting the user to MTP specific programs. One specific concern is that antivirus programs of the host computer may not be aware of MTP devices, making them potentially less secure than mass storage devices.[citation needed] Antivirus scanning might also be impractical due to blocking regular use of the device.

Explicit list of supported devices[edit]

In at least some implementations of MTP, including libmtp,[9] vendor and product ID numbers of all supported devices must be listed. This has the drawback of delaying support for new devices until the device becomes available, the necessary details are submitted to developers, and the updated software reaches end users.

Restrictive list of possible file formats[edit]

The MTP specification includes an enumeration of file formats, called object format.[4] 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.[10]

Direct modification and partial transfer features[edit]

These features can be used as more efficient alternatives to whole-file transfers and re-uploads.

From the MTP 1.1 spec:[4]

Opcode Operation Name Explanation
0x9805 GetObjectPropList Metadata transfer
0x9806 SetObjectPropList
0x1019 MoveObject Rename a file or directory
0x101B GetPartialObject Request a byte range of a file

Android extensions[edit]

According to go-mtpfs:[8]

Opcode Operation Name Explanation
0x95C1 GetPartialObject64 Same as GetPartialObject, but with 64 bit offset
0x95C2 SendPartialObject Same as GetPartialObject64, but copying host to device
0x95C3 TruncateObject Truncates file to 64 bit length
0x95C4 BeginEditObject Must be called before using SendPartialObject and TruncateObject
0x95C5 EndEditObject Called to commit changes made by SendPartialObject and TruncateObject

MTP support[edit]


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.[11] 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.[citation needed]

Most MTP-compatible devices are not assigned drive letters; instead, they appear as "devices" in applications such as Windows Explorer. Compared to devices that implement USB mass storage, such devices cannot be accessed programatically by scripts or normal Windows programs that depend on drive letters. Instead, files must be manipulated using Windows Explorer or applications with specially written MTP support. Another disadvantage of MTP devices on Windows is that file timestamps are not shown in Windows Explorer, although they can be retrieved by opening the file Properties popup.

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 and file playback counts) on a device can be propagated back to the computer when the device is reconnected.

Copies of files accessed over MTP may remain on the host computer even after reboot,[citation needed] 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. Windows 7's sensor platform supports sensors built into MTP-compatible devices.[12]

Unix-like systems[edit]

A free and open-source implementation of the Media Transfer Protocol is available as libmtp.[13] This library incorporates product and device IDs from many sources,[9] and is commonly used in other software for MTP support.


GNOME applications like GNOME Files (formerly called Nautilus) and Archive Manager (formerly called File-Roller) use GIO-based GVfs to access files on MTP devices. Proper MTP support was added to GVfs in version 1.15.2 (2013-01-15)[14] by Philip Langdale.[15][16] Early patches for GVfs to enable Google's direct I/O extensions are available.[17]

The KDE Project develops the MTP KIO Slave with a similar level of integration as GVfs.

Not related to GNOME or KDE is the *NIX graphical MTP-capable media player, gMTP.

Virtual file system[edit]

Several tools provide a FUSE based file system for mounting MTP devices within the Unix filesystem hierarchy, making it accessible to any program that operates on files and directories. Examples include mtpfs, jMTPFS, go-mtpfs and simple-mtpfs.[18]


macOS 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.[19] However, Android File Transfer hasn’t been updated for several years and the program is labelled Abandonware by Android Central.[20]
  • XNJB also offers syncing of iTunes playlists.[21]
  • SyncMate Expert claims to also support MTP besides other synchronization tasks. The support can't be tested in the free version.[22]

Other operating systems[edit]

Later versions of several operating systems, including AmigaOS, Android, AROS, MorphOS, and Symbian OS support MTP, sometimes with additional drivers or software.

A disadvantage of MTP devices on Android as compared to USB mass storage is that although file timestamps are preserved when copying files from the Android device to one's computer, when copying in the other direction, the file modification timestamps are replaced with the time the copy was done.[23][24]

Other manufacturers[edit]

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.


See also[edit]


  1. ^ a b "Media Transfer Protocol Implementation Details". MTP defined in slide 3. Archived from the original on December 14, 2005. 
  2. ^ "Final Availability of Windows Media Player 10 Brings More Music and More Choices to Music Fans" (Press release). Microsoft. September 2, 2004. Archived from the original on March 7, 2006. 
  3. ^ "MTP, Portable Player Standard? Microsoft's McLauchlan Sets Us Straight". July 31, 2006. Retrieved June 1, 2016. 
  4. ^ a b c MTP Specification 1.1 on
  5. ^ "MTP Over Various Transports". Retrieved June 1, 2016. 
  6. ^ "MTP Specification". Archived from the original on June 4, 2011. 
  7. ^ "Normal file read/write support with the GVFS MTP backend!". February 18, 2013. Retrieved June 1, 2016. 
  8. ^ a b "hanwen/go-mtpfs". Retrieved June 1, 2016. 
  9. ^ a b "libmtp source code: music_players.h". Retrieved November 26, 2015. 
  10. ^ "Webm (VP8, VP9, Opus) support for Sailfish -". Retrieved June 1, 2016. 
  11. ^ "Media Transfer Protocol Porting Kit". Microsoft. Retrieved June 1, 2016. 
  12. ^ "Sensors and Windows". Windows Portable Devices Team Blog. December 17, 2009. 
  13. ^ "libmtp". Retrieved March 15, 2014. 
  14. ^ "gvfs-1.15.2.changes". January 15, 2013. Retrieved June 6, 2013. 
  15. ^ "Native gvfs backend for MTP devices". August 7, 2010. Retrieved June 1, 2016. 
  16. ^ "gvfs - Virtual filesystem implementation for GIO". git commit adding MTP back-end to GVfs. Retrieved June 1, 2016. 
  17. ^ "Bug 695984 – Add support for Android direct I/O extensions". Retrieved June 1, 2016. 
  18. ^ Arch Linux Wiki (September 1, 2014). "MTP". Retrieved October 23, 2014. 
  19. ^ "Android File Transfer". Retrieved March 15, 2014. 
  20. ^ "Hey, Google — how about some love for the Mac Android File Transfer app?". Retrieved September 29, 2016. 
  21. ^ "XNJB". Richard Low. Retrieved June 15, 2014. 
  22. ^ "SyncMate". ELTIMA software. Retrieved June 15, 2014. 
  23. ^ "Issue 57065 - android - Writing files via MTP set date and time for pictures and files to current, does not preserve timestamp. - Android Open Source Project - Issue Tracker - Google Project Hosting". 2016-08-30. Retrieved 2016-09-02. 
  24. ^ "Issue 18624 - android - setLastModified() always fails on Xoom unless running as root - Android Open Source Project - Issue Tracker - Google Project Hosting". 2016-08-30. Retrieved 2016-09-02. 

External links[edit]