[mythtv-users] mpeg2 to audio conversion

Jon Larson jtlarson at u.washington.edu
Thu Sep 20 21:51:50 UTC 2007



Jon Larson wrote:
>
>
> M L Truscott wrote:
>> On Thursday 20 September 2007 16:23:59 Jon Larson wrote:
>>  
>>> David Watkins wrote:
>>>    
>>>> On 20/09/2007, M L Truscott <mltruscott at btinternet.com> wrote:
>>>>      
>>>>> I have some mpeg2 files from dvb radio I'd like to strip the video
>>>>> stream from and store as oggs/mp3s.
>>>>>
>>>>> Any one know of a way of doing it?
>>>>>         
>>>> I've used this in the past to strip audio to a wav.  Should be easy
>>>> enough to get to mp3 or ogg from there.
>>>>
>>>> mplayer infile.mpg -vo null -ao pcm:file=outfile.wav
>>>>       
>>> The following ffmpeg command will capture audio from an mpeg2 source 
>>> and
>>> save it as low-bitrate mp3. It is optimized for voice, so if your radio
>>> recordings are music you should raise the -ab and -ar values to 192 (in
>>> kbits) and 44100 in Hz), and remove the '-ac 1' option.
>>>
>>> ffmpeg -v quiet -y -i infile -ab 32 -acodec mp3 -ar 22050 -ac 1 
>>> outfile.mp3
>>>
>>> Jon
>>>     
>>
>> I tried the above and this was the result:
>>
>>  ffmpeg -v quiet -y -i /myth/1708_20070920175900.mpg -ab 193 -acodec 
>> mp3 -ar 44100 /myth/content/Music/Doctor_Who.mp3
>> FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
>>   configuration:  --enable-gpl --enable-pp --enable-pthreads 
>> --enable-vorbis --enable-libogg --enable-a52 --enable-dts 
>> --enable-libgsm --enable-dc1394 --disable-debug --enable-mp3lame 
>> --enable-faadbin --enable-faad --enable-faac --enable-xvid 
>> --enable-x264 --enable-amr_nb --enable-amr_wb --enable-shared 
>> --prefix=/usr   libavutil version: 0d.49.0.0
>>   libavcodec version: 0d.51.11.0
>>   libavformat version: 0d.50.5.0
>>   built on Mar 21 2007 14:14:05, gcc: 4.1.2 (Ubuntu 4.1.2-0ubuntu4)
>> Stream mapping:
>>   Stream #0.0 -> #0.0
>> Error while opening codec for output stream #0.0 - maybe incorrect 
>> parameters such as bit_rate, rate, width or height
>>
>> I've clearly missed something - any help please?
>> _______________________________________________
>> mythtv-users mailing list
>> mythtv-users at mythtv.org
>> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>>   
>
> You set "-ab 193" --it should be "-ab 192"
>
> Jon
>
FYI, if you are going to be doing this often, use a user job script like 
pdatranscode.pl (http://www.mythtv.org/wiki/index.php/Pdatranscode.pl) 
and add the command to the jobs section like this (assuming you have Rev 
1.21):

Change the end of line 58 ('filename-format') from .avi to .mp3
Change 59 ('transcoder') from 'lavc' to 'MP3' (It is case-sensitive)
Move the  ); at line 102 down a line and insert the following lines at 102:

#Use this to extract soundtrack from recordings and save to MP3
'MP3' => '/usr/bin/nice -n19 ffmpeg -v quiet -y -i {infile} -ab 192 -ar 
44100 -acodec mp3 {outfile}',

Save the script, and follow Peter's instructions for installing it as a 
user job, then check the user job box when scheduling your recordings.

Jon



More information about the mythtv-users mailing list