Manipulating Radio Recordings

Black Hole

May contain traces of nut
#1
AFAIK, the audio stream in the .ts from a radio station recorded from DVB-T is MP2. Anybody with knowledge (and hopefully experience) of what you can do with it and the best way of doing it please pipe up!

We'll presume the file has been decrypted by one means or another ;)
 

af123

Administrator
Staff member
#2
AFAIK, the audio stream in the .ts from a radio station recorded from DVB-T is MP2. Anybody with knowledge (and hopefully experience) of what you can do with it and the best way of doing it please pipe up!

We'll presume the file has been decrypted by one means or another ;)
I have extracted audio from radio shows before, and trimmed them. I'll work out what I did at the time, but I started the extraction process on the box with the ffmpeg utility.
 

fenlander

Active Member
#3
After all the issues with video, this is a non-problem.
1) Decrypt audio file in place.
2) Open in Freemake via samba or copy file to PC and open it locally.
3) Convert to mp3. The default bitrate offered by Freemake seems to correctly match that of the mp2 source file.
If you want to edit the file, use Audacity or whatever mp3 editor you prefer.

As usual, Splash will play the decrypted .ts file without conversion. It even displays a choice of virtualisations. :D
 

gomezz

Well-Known Member
#4
I regularly copy radio recordings from my Topfield PVR and convert them to MP3 to listen to on my MP3 player while working in the van. I used to use MPEG Streamclip but now use a dedicated utility call REC2MP3 mainly because it comes with a little batch file which just converts all REC files in the same folder one after the other once started. Not sure if REC2MP3 will work with Humax files or if any header difference will confuse it but if you want to give it a try it is available from the Toppy user site. MPEG Streamclip should deffo work regardless.
 

Ezra Pound

Well-Known Member
#6
VLC will also extract the audio from a Radio.Ts or SD.TS as follows :-
open VLC 1.1.11 >>
Media >>
convert / Save >>
add >>
select *.TS file >>
convert / Save (down arrow) >>
convert >>
enter destination.mp3
profile = Audio MP3
start
wait a few seconds
streaming message displayed
 

Ezra Pound

Well-Known Member
#9
MP2 is a video format not an audio format, MP1 and MP2 Video both contain MP3 (correct title is MP1 Layer3), The radio TS format is an Empty MP2 video file with MP1 layer 3 Audio
 

af123

Administrator
Staff member
#11
I've done some testing and Nicesplice works perfectly on radio recordings, decrypted or not. However, since the Humax doesn't let you set bookmarks on a radio recording, that easy way of marking cut points isn't available.

If it is of interest, I could update the web interface to allow you to manually specify the cut points in terms of time then just pass them on to Drutt's nicesplice tool.

Code:
humax# nicesplice -in The\ CMA\ Awards\ 2011_20111111_2200 -out test -cut 0 600 -cut 1200 72000
read header The CMA Awards 2011_20111111_2200.hmt (13184 bytes)
progLen = 7200s, 0 bookmarks, HD = 0
read 60013 entries from The CMA Awards 2011_20111111_2200.nts
cut at 60.0 seconds = frame 501 (60445)
cut at 0.0 seconds = frame 0 (258)
cut at 7200.0 seconds = frame 60005 (7200484)
cut at 120.0 seconds = frame 1000 (120260)
new Section - rounding down to chunk at frame 501 (0 out) from 6868416 to 6868416
Wrote 7118208 bytes to test.ts with 0 paddding for alignment
wrote 507 entries to test
progLen = 60s
wrote header test.hmt (13184 bytes)
 
OP
OP
Black Hole

Black Hole

May contain traces of nut
#12
That's nice, but how would we identify the cut points? As far as I know the only time index we can get from playback is only to the minute. Without being able to pause and get a time index I don't see that this gains anything over exporting the data and using Audacity.

I would be interested in how you use ffmpeg to extract the MP3 stream though.
 

af123

Administrator
Staff member
#13
For the radio programme above, an 'ffprobe' shows that the container contains packets from all of the programmes on that Mux at the time, but all but the one I was recording is empty. I've removed some for brevity..

Code:
humax# ffprobe The\ CMA\ Awards\ 2011_20111111_2200.ts
Input #0, mpegts, from 'The CMA Awards 2011_20111111_2200.ts':
  Duration: 02:00:01.20, start: 46189.865944, bitrate: 937 kb/s
  Program 4170 
    Metadata:
      service_name    : BBC ONE
      service_provider: BBC
... elided ...
  Program 6720 
    Metadata:
      service_name    : BBC Radio 1
      service_provider: BBC
  Program 6784 
    Metadata:
      service_name    : BBC Radio 2
      service_provider: BBC
    Stream #0.0[0x44e](eng): Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
    Stream #0.1[0x456]: Data: [11][0][0][0] / 0x000B
    Stream #0.2[0x1ce9]: Data: [11][0][0][0] / 0x000B
    Stream #0.3[0x1c21]: Data: [11][0][0][0] / 0x000B
    Stream #0.4[0x1c22]: Data: [11][0][0][0] / 0x000B
    Stream #0.5[0x1c23]: Data: [11][0][0][0] / 0x000B
    Stream #0.6[0x1c24]: Data: [11][0][0][0] / 0x000B
    Stream #0.7[0x1c25]: Data: [11][0][0][0] / 0x000B
  Program 6848 
    Metadata:
      service_name    : BBC Radio 3
      service_provider: BBC
  Program 6912 
    Metadata:
      service_name    : BBC Radio 4
      service_provider: BBC
  Program 7168 
    Metadata:
      service_name    : 301
      service_provider: BBC
So the only usable stream in the whole file is #0.0, an mp2 stream. That can be extracted simply with ffmpeg like this:

Code:
humax# ffmpeg -i The\ CMA\ Awards\ 2011_20111111_2200.ts -f mp2 -vn -acodec copy test.mp3
...
humax# ffprobe test.mp3
Input #0, mp3, from 'test.mp3':
  Duration: 02:00:01.21, start: 0.000000, bitrate: 192 kb/s
    Stream #0.0: Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
This is relying on ffmpeg picking the right stream to extract - it is possible to be specific if necessary but for radio recordings there shouldn't be multiple audio streams.

-vn means that you want to discard any video streams, -acodec copy enables audio passthrough (no re-encoding).

For that two-hour programme the operation was surprisingly quick. It can also be used to extract the audio stream from any decrypted recording..
 

af123

Administrator
Staff member
#15
Out of interest, the resulting mp3 is a lot smaller than the original. The frame headers add a lot of overhead to a .ts file as do the null frames that the Humax keeps from the other channels on the mux.

804.9M The CMA Awards 2011_20111111_2200.ts
164.8M test.mp3
 
#16
Sweet - ffmpeg now seems to be working on my box as well (it was broken before)

I might have a go at writing a radio demuxer but I need to work out a sensible rationale that's going to stop it clashing with other crontab stuff, particularly unencrypt. Maybe it's time for a housekeeper programme that will take over the role of seriesfiler/unencrypt etc.
 
OP
OP
Black Hole

Black Hole

May contain traces of nut
#17
That file size reduction will make a good contribution to my disk headroom! Any chance of rolling a one-click conversion? I don't think it needs to be a background process.
 

af123

Administrator
Staff member
#19
That file size reduction will make a good contribution to my disk headroom! Any chance of rolling a one-click conversion? I don't think it needs to be a background process.
I'll add it to the webif as an option if ffmpeg is installed.

For automation it would make sense for Sam to tie it up with the automatic decryption since the two are related.
 

af123

Administrator
Staff member
#20
I'll add it to the webif as an option if ffmpeg is installed.
0.8.5 has this... ffmpeg is still an optional install but if you have added it then you get an 'Extract Audio' button on the OPT+ context menu, provided that the file has been decrypted first.
 
Top