Re: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-31 Thread Shevek
On 31 March 2011 14:35, richard rich...@richsim900.plus.com wrote:
 Sorry to spoil things, but the patch to ffmpeg has not solved the
 problem with my Marantz CD6003. These are the tests I've done.

I am also finding the new version of ffmpeg doesn't work with iTunes -
it reports an incorrect duration and will not play

This is with an updated version of get_iplayer muxing straight from flv to m4a

I will try the head version of get_iplayer with --raw and see what the
new version of ffmpeg does with that for iTunes

___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Re: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-31 Thread Shevek
On 31 March 2011 14:55, Nick Ludlam n...@recoil.org wrote:
 On 31 Mar 2011, at 14:43, Shevek wrote:

 On 31 March 2011 14:35, richard rich...@richsim900.plus.com wrote:
 Sorry to spoil things, but the patch to ffmpeg has not solved the
 problem with my Marantz CD6003. These are the tests I've done.

 I am also finding the new version of ffmpeg doesn't work with iTunes -
 it reports an incorrect duration and will not play

 This is with an updated version of get_iplayer muxing straight from flv to 
 m4a

 When I was testing things a couple of weeks ago, this also corrupted the 
 output for me (or crashed, cant remember), but using an intermediate output 
 of an AAC file solved the problem, hence the current two step solution.



indeed, however we are now testing against a new build of ffmpeg which
will hopefully do away with the two step process

___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Re: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-31 Thread Jon Davies
On 31 March 2011 14:35, richard rich...@richsim900.plus.com wrote:

 Sorry to spoil things, but the patch to ffmpeg has not solved the
 problem with my Marantz CD6003. These are the tests I've done.
 ...snip

We seem to have established that ffmpeg isn't generating entirely
valid mpeg4 files, I wonder does it work if you pipe it through MP4Box
on the way? thus:

ffmpeg -i Bells_on_Sunday_-_27_03_2011_b00zq9t8_default.flv -acodec
copy -absf aac_adtstoasc temp.m4a
MP4Box -add temp.m4a:mpeg4 -sbr -ipod Bells-on-Sunday.m4a
AtomicParsley Bells-on-Sunday.m4a --artist BBC Radio 4 --title
Bells on Sunday --overWrite

... though if this works I'd be reluctant to advocate adding another
program dependency to get_iplayer - I'd be inclined to consider it a
workaround.

I don't have an ipod and itunes to hand, but for a test file I do have
here mp4info reports different things. note the kbps in the audio
track...  it suggests (as I think we're establishing) that ffmpeg
mangles the metadata atoms in a way that makes them inconsistent with
what's actually in the file.  The ffmpeg patch did something in the
textual metadata, it looks like there's another bug in the atom(s)
that describe the audio stream.

ffmpeg-current aac - m4a:
mp4info version 1.6
Classic_Chandler_2._The_Lady_in_the_Lake.m4a:
Track   Type    Info
1       audio   MPEG-4 AAC LC, 5400.102 secs, 0 kbps, 44100 Hz
 Name: Classic Chandler: 2. The Lady
 Artist: BBC Radio 4
 Tool: Lavf52.94.0
 Year: 2011
 Album: Saturday Play
 Comment: Derace Kingsley, a wealthy bus

MP4Box raw aac - m4a:
mp4info version 1.6
foo2a.m4a:
Track   Type    Info
1       audio   MPEG-4 AAC LC, 5400.032 secs, 128 kbps, 44100 Hz

MP4Box raw aac - m4a followed by AtomicParsley to add a couple of tags:
mp4info version 1.6
foo2b.m4a:
Track   Type    Info
1       audio   MPEG-4 AAC LC, 5400.032 secs, 128 kbps, 44100 Hz
 Name: Classic Chandler: 2. The Lady in the Lake
 Artist: BBC Radio 4

___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Re: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-31 Thread Shevek
On 31 March 2011 15:34, Jon Davies j...@hedgerows.org.uk wrote:
 On 31 March 2011 14:35, richard rich...@richsim900.plus.com wrote:

 Sorry to spoil things, but the patch to ffmpeg has not solved the
 problem with my Marantz CD6003. These are the tests I've done.
 ...snip

 We seem to have established that ffmpeg isn't generating entirely
 valid mpeg4 files, I wonder does it work if you pipe it through MP4Box
 on the way? thus:

 ffmpeg -i Bells_on_Sunday_-_27_03_2011_b00zq9t8_default.flv -acodec
 copy -absf aac_adtstoasc temp.m4a
 MP4Box -add temp.m4a:mpeg4 -sbr -ipod Bells-on-Sunday.m4a
 AtomicParsley Bells-on-Sunday.m4a --artist BBC Radio 4 --title
 Bells on Sunday --overWrite

 ... though if this works I'd be reluctant to advocate adding another
 program dependency to get_iplayer - I'd be inclined to consider it a
 workaround.

This is possibly a stupid question, but can ffmpeg pipe to itself to
do both things separately but in one command?

___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Re: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-31 Thread dinkypumpkin

On 31 Mar 2011, at 16:01, Shevek wrote:

 This is possibly a stupid question, but can ffmpeg pipe to itself to
 do both things separately but in one command?

This worked for me:

ffmpeg -i test.flv -vn -acodec copy -f adts - | ffmpeg -i - -vn -acodec copy 
-absf aac_adtstoasc -y test.m4a

I think the trick is choosing the right output format from the first ffmpeg 
command.  It needs to use a muxer that doesn't require seekable output, so adts 
seemed like the right choice.
___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


RE: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-31 Thread bat guano




 Subject: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)
 From: rich...@richsim900.plus.com
 To: get_iplayer@lists.infradead.org
 Date: Thu, 31 Mar 2011 14:35:54 +0100

 Sorry to spoil things, but the patch to ffmpeg has not solved the
 problem with my Marantz CD6003. 

@ Richard
Using your new version of FFmpeg...
When you convert other mp3 files to m4a using command:-
ffmpeg filename -acodec libfaac output.m4a

Do they now play in your Marantz straight off, or do you still need to use 
EasyTAG?
  
___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Re: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-31 Thread Shevek
On 31 March 2011 16:21, dinkypumpkin dinkypump...@gmail.com wrote:

 On 31 Mar 2011, at 16:01, Shevek wrote:

 This is possibly a stupid question, but can ffmpeg pipe to itself to
 do both things separately but in one command?

 This worked for me:

 ffmpeg -i test.flv -vn -acodec copy -f adts - | ffmpeg -i - -vn -acodec copy 
 -absf aac_adtstoasc -y test.m4a

 I think the trick is choosing the right output format from the first ffmpeg 
 command.  It needs to use a muxer that doesn't require seekable output, so 
 adts seemed like the right choice.


This works great, however with get_iplayer on windows it is possible
to have spaces in the file path and so only works if the flv and m4a
paths are in quotes.

How will this affect linux versions?

___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Re: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-31 Thread Roger Burton West
On Thu, Mar 31, 2011 at 08:22:26PM +0100, Shevek wrote:
What am I doing wrong?

You can't use shell functions (such as pipe) with the list-form
invocation of system().

Easiest option (though it's vulnerable to shellmetas showing up in
filenames) is probably to do it all in one string: set $cmd instead of
@cmd and system($cmd).

Slightly harder but more secure option would be to do it in two stages
using a tmpfile - or to build your own pipework to join the two
processes.

R

___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Re: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-31 Thread dinkypumpkin

On 31 Mar 2011, at 20:33, Roger Burton West wrote:

 On Thu, Mar 31, 2011 at 08:22:26PM +0100, Shevek wrote:
 What am I doing wrong?
 
 You can't use shell functions (such as pipe) with the list-form
 invocation of system().

Sorry, Shevek - I should have warned you about that beforehand.


___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Re: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-31 Thread Shevek
On 31 March 2011 20:33, Roger Burton West ro...@firedrake.org wrote:
 On Thu, Mar 31, 2011 at 08:22:26PM +0100, Shevek wrote:
What am I doing wrong?

 You can't use shell functions (such as pipe) with the list-form
 invocation of system().

I thought it would be something like that. Thanks for the confirmation.


 Easiest option (though it's vulnerable to shellmetas showing up in
 filenames) is probably to do it all in one string: set $cmd instead of
 @cmd and system($cmd).

I'll look into this


 Slightly harder but more secure option would be to do it in two stages
 using a tmpfile - or to build your own pipework to join the two
 processes.


heh, I was trying to do it this way to avoid doing it in 2 stages :)

___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Re: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-31 Thread Shevek
On 31 March 2011 20:36, dinkypumpkin dinkypump...@gmail.com wrote:

 On 31 Mar 2011, at 20:33, Roger Burton West wrote:

 On Thu, Mar 31, 2011 at 08:22:26PM +0100, Shevek wrote:
 What am I doing wrong?

 You can't use shell functions (such as pipe) with the list-form
 invocation of system().

 Sorry, Shevek - I should have warned you about that beforehand.


no worries!

At least this a good learning experience for me.

And to Roger, I think I forgot to add a Thanks in my previous reply

Shevek.

___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Re: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-31 Thread Shevek
On 31 March 2011 20:33, Roger Burton West ro...@firedrake.org wrote:
 On Thu, Mar 31, 2011 at 08:22:26PM +0100, Shevek wrote:
What am I doing wrong?

 Easiest option (though it's vulnerable to shellmetas showing up in
 filenames) is probably to do it all in one string: set $cmd instead of
 @cmd and system($cmd).


OK, this is what I came up with and it works:

@cmd = (
$bin-{ffmpeg} . ' -i ' . $file_tmp . ' -vn -acodec copy -f adts -
| ' . $bin-{ffmpeg} . ' -i - -vn -acodec copy -absf aac_adtstoasc -y
' . $prog-{filepart} . '',
);

does anyone have any objections to this?

___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Re: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-31 Thread Shevek
On 31 March 2011 20:49, dinkypumpkin dinkypump...@gmail.com wrote:

 On 31 Mar 2011, at 20:44, Shevek wrote:

 On 31 March 2011 20:33, Roger Burton West ro...@firedrake.org wrote:
 On Thu, Mar 31, 2011 at 08:22:26PM +0100, Shevek wrote:
 What am I doing wrong?

 Easiest option (though it's vulnerable to shellmetas showing up in
 filenames) is probably to do it all in one string: set $cmd instead of
 @cmd and system($cmd).


 OK, this is what I came up with and it works:

 @cmd = (
       $bin-{ffmpeg} . ' -i ' . $file_tmp . ' -vn -acodec copy -f adts -
 | ' . $bin-{ffmpeg} . ' -i - -vn -acodec copy -absf aac_adtstoasc -y
 ' . $prog-{filepart} . '',
 );

 does anyone have any objections to this?

 Path to ffmpeg exe might have spaces, so should be quoted as well.


good spot...

it's odd, because up till now none of the paths have been quoted, but
it has always worked, even with paths with spaces in - is this because
of the system() call which I am now changing?

___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


RE: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-31 Thread bat guano






 OK, this is what I came up with and it works:

 @cmd = (
 $bin-{ffmpeg} . ' -i ' . $file_tmp . ' -vn -acodec copy -f adts -
 | ' . $bin-{ffmpeg} . ' -i - -vn -acodec copy -absf aac_adtstoasc -y
 ' . $prog-{filepart} . '',
 );

 does anyone have any objections to this?

No objections from me shevek.
But aren't those '-vn' and '-vn' and '-y' redundant?
Or are they needed for some reason?

  
___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Re: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-31 Thread dinkypumpkin

On 31 Mar 2011, at 20:52, Shevek wrote:

 On 31 March 2011 20:49, dinkypumpkin dinkypump...@gmail.com wrote:
 
 
 Path to ffmpeg exe might have spaces, so should be quoted as well.
 
 
 good spot...
 
 it's odd, because up till now none of the paths have been quoted, but
 it has always worked, even with paths with spaces in - is this because
 of the system() call which I am now changing?

Yes.  Perl pros here should correct me, but I think now that you effectively 
passing a list of length = 1 to system() or open3 (under the hood of 
main::run_cmd), you need to handle all internal quoting yourself.


___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Re: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-31 Thread Roger Burton West
On Thu, Mar 31, 2011 at 08:56:59PM +0100, dinkypumpkin wrote:

Yes.  Perl pros here should correct me, but I think now that you effectively 
passing a list of length = 1 to system() or open3 (under the hood of 
main::run_cmd), you need to handle all internal quoting yourself.

Yes. The array form is much more secure because you don't need to worry
about weird characters in file names, but because the single-argument
form _does_ interpret those weird characters it can handle pipes and
redirection.

R

___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Re: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-31 Thread dinkypumpkin

On 31 Mar 2011, at 20:54, bat guano wrote:

 
 OK, this is what I came up with and it works:
 
 @cmd = (
 $bin-{ffmpeg} . ' -i ' . $file_tmp . ' -vn -acodec copy -f adts -
 | ' . $bin-{ffmpeg} . ' -i - -vn -acodec copy -absf aac_adtstoasc -y
 ' . $prog-{filepart} . '',
 );
 
 does anyone have any objections to this?
 
 No objections from me shevek.
 But aren't those '-vn' and '-vn' and '-y' redundant?
 Or are they needed for some reason?
 

The -vn can probably go, but does no harm.  I think -y should stay to ensure 
that --force --overwrite args to get_iplayer give expected results.


___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Re: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-28 Thread Jon Davies
On 28 March 2011 13:59, richard rich...@richsim900.plus.com wrote:
 I've done some tests with MediaInfo and AtomicParsley to try and find
 why EasyTag makes the m4a file playable on my Marantz cd player.
...
 2. Bells_after.m4a :- This is the default file after amending in EasyTag
 (deleting album info and saving file) It plays OK after approx 25 second
 delay.

I have a theory:

As I understand it mpeg-4 files are made of atoms, and each atom can
potentially contain either metadata or stream data.  What if your
marantz cd player doesn't understand the atom that contains the
thumbnail (which is added AtomicParsley in Shevek's patch), and it
spends 25s trying to play this as audio, failing to decode and hence
playing mute instead?

I can think of a couple of tests for this theory:
(a) use AtomicParsley to remove the thumbnail tag, and see if the file
then plays as expected
 (AtomicParsley file.m4a --artwork REMOVE_ALL apparently)
(b) use a metadata editor other than AP to add a thumbnail tag, and
see if the file breaks

Jon

___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Re: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-27 Thread Shevek
I'll see if I can update my patch to remove that tag...

Sent from my iPhone

On 27 Mar 2011, at 14:11, richard rich...@richsim900.plus.com wrote:

 Neither Shevek's patch to output as m4a (or Nick Ludlam's) play on my
 hifi CD player (Marantz CD6003) via the USB port. It gives a header
 error. But I found a workaround using EasyTag 2.1.5.
 
 
 bat guano referred to it earlier here:
 
 http://lists.infradead.org/pipermail/get_iplayer/2011-March/001074.html
 
 bat guano wrote:
 
 
 Load the file into EasyTAG-aac v1.1.5.
 
 Delete Lavf52.103.0 from the 'Encoded by' box.
 
 Save changes and exit.
 
 I suspect that EasyTAG is doing a little more than just deleting a
 tag.
 
 Maybe it's shuffling some atoms around before it saves.
 
 If I could find out what the difference is between the files it would
 be easier to use a command instead of messing about with the EasyTAG
 gui.
 
 Can any of you figure it out?
 
 This is what I did:-
 
 I opened an 4ma file in EasyTag. Made an amendment to the tag. The
 amendment can be anything. Delete or add any text to the tag (it doesn't
 seem to matter either way) and then save the file.
 
 The m4a now plays in my CD player (via USB port) after a delay of about
 20-25 seconds.
 
 Can any of you work out the reason why altering the tag in EastTag makes
 the m4a file playable.
 
 Could the get_iplayer script be amended to do the same? 
 
 
 
 
 
 
 
 ___
 get_iplayer mailing list
 get_iplayer@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/get_iplayer

___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


RE: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-27 Thread bat guano




 From: she...@o2.co.uk
 Subject: Re: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)
 Date: Sun, 27 Mar 2011 14:16:35 +0100
 To: rich...@richsim900.plus.com
 CC: get_iplayer@lists.infradead.org

 I'll see if I can update my patch to remove that tag...

Hi shevek
I think there's more to it than that.

In my opinion, ffmpeg handles aac/m4a files in a way that
isn't friendly with some players.

It's not just the BBC files either.
When I convert other files to m4a using ffmpeg like this:-
ffmpeg -i foo -acodec libfaac foo.m4a

they won't play in the Shuffle until I've modified them using EASYTag.



  
___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Re: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-27 Thread James Cook
On Sun, 27 Mar 2011 14:05:17 +, you wrote:


In my opinion, ffmpeg handles aac/m4a files in a way that
isn't friendly with some players.

It's not just the BBC files either.
When I convert other files to m4a using ffmpeg like this:-
ffmpeg -i foo -acodec libfaac foo.m4a

they won't play in the Shuffle until I've modified them using EASYTag.

Are you sure you are using the ffmpeg Shevek mentioned?

type 
ffmpeg -version
and you shoud get something like:

FFmpeg version git-c9e16a9-Sherpya, Copyright (c) 2000-2011 the FFmpeg
developer
s
  built on Feb  4 2011 07:04:01 with gcc 4.2.5 20090330 (prerelease)
[Sherpya]
  libavutil50. 37. 0 / 50. 37. 0
  libavcore 0. 16. 1 /  0. 16. 1
  libavcodec   52.109. 0 / 52.109. 0
  libavformat  52. 95. 0 / 52. 95. 0
  libavdevice  52.  2. 3 / 52.  2. 3
  libavfilter   1. 74. 0 /  1. 74. 0
  libswscale0. 12. 0 /  0. 12. 0
  libpostproc  51.  2. 0 / 51.  2. 0
FFmpeg git-c9e16a9-Sherpya
libavutil50. 37. 0 / 50. 37. 0
libavcore 0. 16. 1 /  0. 16. 1
libavcodec   52.109. 0 / 52.109. 0
libavformat  52. 95. 0 / 52. 95. 0
libavdevice  52.  2. 3 / 52.  2. 3
libavfilter   1. 74. 0 /  1. 74. 0
libswscale0. 12. 0 /  0. 12. 0
libpostproc  51.  2. 0 / 51.  2. 0

JC

___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


RE: [PATCH] Output AAC as M4A for iTunes with metadata tags (Shevek)

2011-03-27 Thread bat guano






 Which version of ffmpeg are you using?


I'm using this version with Ubuntu Karmic:-

FFmpeg version git-N-28651-gf55dd6c, Copyright (c) 2000-2011 the FFmpeg 
developers
  built on Mar 26 2011 11:51:58 with gcc 4.4.1
  configuration: --enable-gpl --enable-version3 --enable-nonfree 
--enable-postproc --enable-pthreads --enable-libfaac --enable-libmp3lame 
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora 
--enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid 
--enable-x11grab --disable-encoder=vorbis
  libavutil    50. 40. 0 / 50. 40. 0
  libavcodec   52.115. 0 / 52.115. 0
  libavformat  52.103. 0 / 52.103. 0
  libavdevice  52.  3. 0 / 52.  3. 0
  libavfilter   1. 76. 0 /  1. 76. 0
  libswscale    0. 13. 0 /  0. 13. 0
  libpostproc  51.  2. 0 / 51.  2. 0
FFmpeg git-N-28651-gf55dd6c
libavutil    50. 40. 0 / 50. 40. 0
libavcodec   52.115. 0 / 52.115. 0
libavformat  52.103. 0 / 52.103. 0
libavdevice  52.  3. 0 / 52.  3. 0
libavfilter   1. 76. 0 /  1. 76. 0
libswscale    0. 13. 0 /  0. 13. 0
libpostproc  51.  2. 0 / 51.  2. 0

  
___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer