Bug 291722

Summary: Support for transcoding when transferring music to iPod/iPhone
Product: [Applications] amarok Reporter: Santiago Gil <santix91>
Component: Collections/iPod iPhoneAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: wishlist CC: matej, onionliu123
Priority: NOR    
Version: 2.5.0   
Target Milestone: 2.6   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In: 2.6
Sentry Crash Report:

Description Santiago Gil 2012-01-17 01:19:53 UTC
Version:           2.5.0 (using KDE 4.6.5) 
OS:                Linux

I'm using Amarok 2.5.0, and to my delight it can transfer songs to my second-generation iPod Touch.

The iPod is detected automatically, songs play in it, and the artwork is displayed properly. Also, when transferring music files that are not encoded in MP3 (I tested with FLAC files), they are converted to MP3 automatically. So far, so good.

However, I realized that the re-encoding process maintains the original bitrate of the files. Thus causing to end up with things like 800kbps MP3s.

Reproducible: Always



Expected Results:  
My wish, and I think it would be something useful for a lot of users, is to have the option of choosing the bitrate of the re-encoded files. 

Also, I think the user should be able to select the codec used. I couldn't find much information about how is all this implemented in Amarok, but in case of relying on outside tools I guess it shouldn't be too difficult to implement.

Thank you very much to all of you who make this amazing music player possible.
Comment 1 Myriam Schweingruber 2012-01-17 07:57:38 UTC
What do you mean by "Select the codec used"? Amarok doesn't play sound itself, it lets Phonon do so. The codec for mp3 is not free and rarely shipped by distributions due to patent reasons so it is usually up to the user to download and install it, depending on the Phonon backend installed. This is totally independent of Amarok.
Please do not submit two wishes in one report.
Comment 2 Matěj Laitl 2012-01-17 11:01:14 UTC
(In reply to comment #1)
> What do you mean by "Select the codec used"? Amarok doesn't play sound itself,
> it lets Phonon do so. The codec for mp3 is not free and rarely shipped by
> distributions due to patent reasons so it is usually up to the user to download
> and install it, depending on the Phonon backend installed. This is totally
> independent of Amarok.
> Please do not submit two wishes in one report.

Myriam, I think you misunderstood reporter. The report is about trancoding the music when copying it from Local Collection to iPod/iPhone collection. (and is just one wish)

santix91, Amarok 2.5 is _not_ able to transcode music when transferred to iPod collection, what you see is probably a bug where Amarok just renames .flac files to .mp3 files - I wonder whether these are playable on iPod. (?)

Good news is that I'm rewriting iPod collection for Amarok 2.6 [1], it is already working well for traditional iPods, but I need someone who could test on iOS devices, would you be willing to help? The rewrite will support playlists, transcoding and more. For start, I'd like to see output of `solid-hardware list details` with your iPod touch plugged in.

[1] http://quickgit.kde.org/?p=clones%2Famarok%2Flaitl%2Famarok.git&a=shortlog&h=refs/heads/ipod-rewrite
Comment 3 Santiago Gil 2012-01-17 19:09:31 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > What do you mean by "Select the codec used"? Amarok doesn't play sound itself,
> > it lets Phonon do so. The codec for mp3 is not free and rarely shipped by
> > distributions due to patent reasons so it is usually up to the user to download
> > and install it, depending on the Phonon backend installed. This is totally
> > independent of Amarok.
> > Please do not submit two wishes in one report.
> 
> Myriam, I think you misunderstood reporter. The report is about trancoding the
> music when copying it from Local Collection to iPod/iPhone collection. (and is
> just one wish)
> 
> santix91, Amarok 2.5 is _not_ able to transcode music when transferred to iPod
> collection, what you see is probably a bug where Amarok just renames .flac
> files to .mp3 files - I wonder whether these are playable on iPod. (?)
> 
> Good news is that I'm rewriting iPod collection for Amarok 2.6 [1], it is
> already working well for traditional iPods, but I need someone who could test
> on iOS devices, would you be willing to help? The rewrite will support
> playlists, transcoding and more. For start, I'd like to see output of
> `solid-hardware list details` with your iPod touch plugged in.
> 
> [1]
> http://quickgit.kde.org/?p=clones%2Famarok%2Flaitl%2Famarok.git&a=shortlog&h=refs/heads/ipod-rewrite
Right, it's like Matěj says, Myriam.

Now that you mentioned that, I double checked, and it turns out it doesn't let me transfer songs that are not encoded in mp3. It returns an error saying that “Those tracks are already in the device”.  Now, if I try to transfer tracks that actually ARE in the device, there is no error message. (Guess that would make a bug report?).

I'd be glad to help. What would I need to do, download, compile and install Amarok 2.6? Or can I just update the iPod add-on?

Here is my iPod listed on 'solid-hardware list details': 
http://pastebin.com/tU4k63Ff
Comment 4 Matěj Laitl 2012-03-16 20:10:03 UTC
Git commit 1a0287f7925d92a05a530ab83fffbc9afae67e86 by Matěj Laitl.
Committed on 21/01/2012 at 01:13.
Pushed by laitl into branch 'master'.

Rework transcoding: remember encoder, transcode on move, cleaner code

This is a major rework of transcoding feature that brings following
user-visible changes to Amarok:
 * Amarok can remember preferred transcoding configuration per each
   collection that supports transcoding. Therefore, the "Use default
   configuration" work-around can go away and the "Transcode or copy?"
   dialog can (and is) be one-step now. This preference can be changed
   in configuration.
 * Transcoding is now supported even during the move operation. No
   worries, only successfully transcoded tracks are removed from their
   original location.
 * Only formats playable on the target collection are offered. Already
   used & tested in yet-to-be-merged iPod collection rewrite.
 * The "Organize Tracks" dialog title and progress bar operation name
   now more verbosely describe actual operation to prevent user
   mistakes.
 * Double-transcode when ripping audio CDs that caused failures is
   avoided. (ChangeLog entry for this was miscredited to my earilier
   commit)

Technically, following changes are made:
 * many methods that accepted optional TranscodingConfiguration now
   either have it mandatory or not at all.
 * TranscodingConfiguration's NULL_CODEC was splitted to JUST_COPY and
   INVALID along with convenience methods isValid() and isJustCopy().
   This simplifies logic in many methods.
 * CollectionLocation::prepare{Copy,Move}() now don't have optional
   TranscodingConfiguration parameter. Depending on target collection,
   CollectionLocation determines it automatically or asks user in
   showSourceDialog() (overridable). AudioCdCollectionLocation already
   overrides it.
 * Collections that support transcoding now should expose
   TranscodeCapability which is used to a) indicate that transcoding
   is supported; b) query which file formats are playable on target
   collection; c) read & save & unset preferred transcoding parameters.

Why the hell the new Capability?
================================

Many Amarok devs dislike the concept of capabilities[1]. Why the hell I
introduced the new one? In ideal world Amarok would be able to transcode
everything regardless of the target collection. This is however not
doable witch current copyUrlToCollection() design - target collection
needs to do non-trivial things such as re-reading file tags, accounting
for different file name and space requirements etc. See my comments in
[1]. We therefore need a way for target collection to indicate it
supports transcoding (in order not to fool user). Some collection
locations such as TrashCollectionLocation should even intentionally
disallow transcoding. Additionally, we want to be able to query
supported destination file formats, to save preferred transcoding
paremeters etc.

I simply didn't want to pollute already over-crowded CollectionLocation
with three more methods used by only a few subclasses. On the other
hand, TranscodeCapability is not the central idea of this patch and I
can factor it into CollectionLocation should there be a voice supporting
it.

v2 patch version: gui string changes as suggested by Bart & Teo

[1] https://git.reviewboard.kde.org/r/103752/
Related: bug 280526, bug 264681, bug 263775
FIXED-IN: 2.6
REVIEW: 104213
DIGEST: Feature: much improved transcoding

M  +4    -1    ChangeLog
M  +1    -0    src/CMakeLists.txt
M  +10   -33   src/browsers/CollectionTreeView.cpp
M  +1    -2    src/browsers/CollectionTreeView.h
M  +1    -38   src/browsers/filebrowser/FileView.cpp
M  +0    -1    src/browsers/filebrowser/FileView.h
M  +21   -3    src/configdialog/dialogs/CollectionConfig.cpp
M  +33   -0    src/configdialog/dialogs/CollectionConfig.ui
M  +48   -12   src/core-impl/collections/db/sql/SqlCollection.cpp
M  +14   -1    src/core-impl/collections/db/sql/SqlCollection.h
M  +39   -18   src/core-impl/collections/db/sql/SqlCollectionLocation.cpp
M  +3    -1    src/core-impl/collections/db/sql/SqlCollectionLocation.h
M  +1    -1    src/core-impl/collections/mediadevicecollection/MediaDeviceCollectionLocation.h
M  +17   -0    src/core-impl/collections/support/CollectionLocationDelegateImpl.cpp
M  +3    -0    src/core-impl/collections/support/CollectionLocationDelegateImpl.h
M  +1    -1    src/core-impl/collections/support/PlaylistCollectionLocation.h
M  +2    -2    src/core-impl/collections/support/TrashCollectionLocation.h
M  +1    -1    src/core-impl/collections/umscollection/UmsCollectionLocation.h
M  +1    -0    src/core/CMakeLists.txt
M  +1    -0    src/core/capabilities/Capability.h
C  +5    -22   src/core/capabilities/TranscodeCapability.cpp [from: src/core/transcoding/TranscodingConfiguration.cpp - 073% similarity]
A  +84   -0    src/core/capabilities/TranscodeCapability.h     [License: GPL (v2+)]
M  +64   -21   src/core/collections/CollectionLocation.cpp
M  +19   -8    src/core/collections/CollectionLocation.h
M  +22   -0    src/core/collections/CollectionLocationDelegate.h
M  +112  -3    src/core/transcoding/TranscodingConfiguration.cpp
M  +41   -4    src/core/transcoding/TranscodingConfiguration.h
M  +17   -16   src/core/transcoding/TranscodingController.cpp
M  +21   -9    src/core/transcoding/TranscodingController.h
M  +11   -12   src/core/transcoding/TranscodingDefines.h
M  +3    -1    src/core/transcoding/TranscodingFormat.h
M  +4    -6    src/core/transcoding/formats/TranscodingNullFormat.cpp
M  +1    -1    src/core/transcoding/formats/TranscodingNullFormat.h
M  +2    -6    src/services/magnatune/MagnatuneCollectionLocation.cpp
M  +1    -1    src/services/mp3tunes/Mp3tunesServiceCollectionLocation.h
M  +1    -0    src/transcoding/CMakeLists.txt
M  +83   -75   src/transcoding/TranscodingAssistantDialog.cpp
M  +25   -9    src/transcoding/TranscodingAssistantDialog.h
M  +157  -296  src/transcoding/TranscodingAssistantDialog.ui
M  +3    -2    src/transcoding/TranscodingOptionsStackedWidget.cpp
A  +55   -0    src/transcoding/TranscodingSelectConfigWidget.cpp     [License: GPL (v2+)]
C  +42   -39   src/transcoding/TranscodingSelectConfigWidget.h [from: src/transcoding/TranscodingAssistantDialog.h - 050% similarity]
M  +1    -0    tests/core-impl/collections/db/sql/TestSqlCollectionLocation.cpp
M  +3    -0    tests/core/collections/MockCollectionLocationDelegate.h

http://commits.kde.org/amarok/1a0287f7925d92a05a530ab83fffbc9afae67e86
Comment 5 Matěj Laitl 2012-04-15 15:43:43 UTC
Git commit 9bfe431375630655047ea8681a12ff6bd5422839 by Matěj Laitl.
Committed on 15/04/2012 at 12:24.
Pushed by laitl into branch 'master'.

Complete iPod collection rewrite (also supports iPad, iPhone)

This is a result of 3-month effort to make Amarok iPod-like device
support future-proof and less buggy by using more modern MemoryMeta
framework to manage tracks internally.

The new plugin still uses libgpod [1] to access the devices and
supports all devices supported by it. The newest models may need the
infamous libashab.so library.

FEATURES:
 * Small configuration dialog for iPods that shows troubleshooting information
   and allows to change iPod name.
 * Improved usability of iPod playlists: iPod collection automatically transfers
   tracks dropped to iPod playlists to iPod when it is needed.
 * Tracks can now be transcoded when transferring them to iPod.

CHANGES:
 * optional libgpod dependency raised to 0.8.2 to support newest iPods.
 * Amarok now prevents accidental unmounting of iPods in (small) time-frames
   when iTunes database on iPod is not yet updated.
 * Amarok detects when iPod is to be ejected from system and gracefully
   disconnects it when it occurs.
 * Hitting the eject button on iPod collection ejects it also from the system.
 * iPod collection now detects whether iPod is safe to write and marks iPod
   as read-only if not. This prevents "iPod shows 0 tracks" problem.
 * Correct progress bar advancement when transferring tracks to iPod.
 * iPod Collection supports multiple simultaneous cancellable transfers.
 * Improved dialog to initialize iPod.

BUGFIXES:
 * Detection and elimination of stale and orphaned iPod tracks now works
   correctly; users are notified about these when iPod is plugged in.
 * iPod playlists now work correctly.
 * Show correct error when transferring unsupported files to iPod.

[1] http://www.gtkpod.org/wiki/Libgpod
Related: bug 139454, bug 219963, bug 279797, bug 289304, bug 234876
FIXED-IN: 2.6
DIGEST: Amarok's iPod support is completely rewritten fixing many bugs
        and adding features

M  +3    -2    CMakeLists.txt
M  +21   -0    ChangeLog
M  +2    -2    README
M  +1    -1    src/core-impl/collections/CMakeLists.txt
A  +80   -0    src/core-impl/collections/ipodcollection/CMakeLists.txt
A  +642  -0    src/core-impl/collections/ipodcollection/IpodCollection.cpp     [License: GPL (v2+)]
A  +260  -0    src/core-impl/collections/ipodcollection/IpodCollection.h     [License: GPL (v2+)]
A  +259  -0    src/core-impl/collections/ipodcollection/IpodCollectionFactory.cpp     [License: GPL (v2+)]
A  +93   -0    src/core-impl/collections/ipodcollection/IpodCollectionFactory.h     [License: GPL (v2+)]
A  +119  -0    src/core-impl/collections/ipodcollection/IpodCollectionLocation.cpp     [License: GPL (v2+)]
A  +74   -0    src/core-impl/collections/ipodcollection/IpodCollectionLocation.h     [License: GPL (v2+)]
A  +845  -0    src/core-impl/collections/ipodcollection/IpodMeta.cpp     [License: GPL (v2+)]
A  +327  -0    src/core-impl/collections/ipodcollection/IpodMeta.h     [License: GPL (v2+)]
A  +141  -0    src/core-impl/collections/ipodcollection/IpodMetaEditCapability.cpp     [License: GPL (v2+)]
A  +63   -0    src/core-impl/collections/ipodcollection/IpodMetaEditCapability.h     [License: GPL (v2+)]
A  +248  -0    src/core-impl/collections/ipodcollection/IpodPlaylist.cpp     [License: GPL (v2+)]
A  +113  -0    src/core-impl/collections/ipodcollection/IpodPlaylist.h     [License: GPL (v2+)]
A  +496  -0    src/core-impl/collections/ipodcollection/IpodPlaylistProvider.cpp     [License: GPL (v2+)]
A  +114  -0    src/core-impl/collections/ipodcollection/IpodPlaylistProvider.h     [License: GPL (v2+)]
A  +24   -0    src/core-impl/collections/ipodcollection/amarok_collection-ipodcollection.desktop
A  +1    -0    src/core-impl/collections/ipodcollection/config-ipodcollection.h.cmake
A  +414  -0    src/core-impl/collections/ipodcollection/jobs/IpodCopyTracksJob.cpp     [License: GPL (v2+)]
A  +108  -0    src/core-impl/collections/ipodcollection/jobs/IpodCopyTracksJob.h     [License: GPL (v2+)]
A  +69   -0    src/core-impl/collections/ipodcollection/jobs/IpodDeleteTracksJob.cpp     [License: GPL (v2+)]
A  +46   -0    src/core-impl/collections/ipodcollection/jobs/IpodDeleteTracksJob.h     [License: GPL (v2+)]
A  +83   -0    src/core-impl/collections/ipodcollection/jobs/IpodParseTracksJob.cpp     [License: GPL (v2+)]
A  +49   -0    src/core-impl/collections/ipodcollection/jobs/IpodParseTracksJob.h     [License: GPL (v2+)]
A  +33   -0    src/core-impl/collections/ipodcollection/jobs/IpodWriteDatabaseJob.cpp     [License: GPL (v2+)]
A  +37   -0    src/core-impl/collections/ipodcollection/jobs/IpodWriteDatabaseJob.h     [License: GPL (v2+)]
A  +205  -0    src/core-impl/collections/ipodcollection/support/IphoneMountPoint.cpp     [License: GPL (v2+)]
A  +53   -0    src/core-impl/collections/ipodcollection/support/IphoneMountPoint.h     [License: GPL (v2+)]
A  +229  -0    src/core-impl/collections/ipodcollection/support/IpodConfiguration.ui
A  +466  -0    src/core-impl/collections/ipodcollection/support/IpodDeviceHelper.cpp     [License: GPL (v2+)]
A  +102  -0    src/core-impl/collections/ipodcollection/support/IpodDeviceHelper.h     [License: GPL (v2+)]
A  +58   -0    src/core-impl/collections/ipodcollection/support/IpodTranscodeCapability.cpp     [License: GPL (v2+)]
A  +49   -0    src/core-impl/collections/ipodcollection/support/IpodTranscodeCapability.h     [License: GPL (v2+)]

http://commits.kde.org/amarok/9bfe431375630655047ea8681a12ff6bd5422839
Comment 6 Matěj Laitl 2012-07-02 09:38:53 UTC
*** Bug 272865 has been marked as a duplicate of this bug. ***