Demuxing an MPEG TS from a USB PVR where the TS is prefixed with invalid data

Hi all, I have a TV which has a built in USB record feature (which basically dumps DVB-T MPEG TS in 2GB chunks). I'd like to pull the audio track out of something I recorded. VLC happily plays the file and identifies the video, audio and EPG info in the transport stream, but if, for example, I run: avconv -i ... -acodec copy audio.mp3 ... I end up with about 2 seconds of silence. It seems there's a couple of dummy streams and also that the overall file is prefixed with what looks like null garbage. I know that if vlc can play it, there's gotta be a way of extracting it, but must admit that I haven't had any luck thus far. Any ideas on recommended tools for stubborn MPEG TS demuxing? Anthony

On 28/12/12 20:08, Anthony Hogan wrote:
Hi all,
I have a TV which has a built in USB record feature (which basically dumps DVB-T MPEG TS in 2GB chunks). I'd like to pull the audio track out of something I recorded. VLC happily plays the file and identifies the video, audio and EPG info in the transport stream
I use Kdenlive to convert MPEG TS into mp4 and xvid. I haven't tried using it to separate audio but it does appear to be able to extract audio into WAV files.

On 12/28/2012 08:08 PM, Anthony Hogan wrote:
Hi all,
Any ideas on recommended tools for stubborn MPEG TS demuxing?
Anthony hi
tested on a recording made by kaffeine of an SBS film, system is Fedora-8 with a DVB-T tuner card. Demuxing was done on another machine. ffmpeg works fine Steve -------------------------------------------- $ ffmpeg -i Micmacs.m2t track1.flac ffmpeg version 0.10.6 Copyright (c) 2000-2012 the FFmpeg developers built on Oct 31 2012 22:23:25 with gcc 4.7.2 20120921 (Red Hat 4.7.2-2) configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib --mandir=/usr/share/man --arch=i686 --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-libass --enable-libcdio --enable-libcelt --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib --cpu=i686 --enable-runtime-cpudetect libavutil 51. 35.100 / 51. 35.100 libavcodec 53. 61.100 / 53. 61.100 libavformat 53. 32.100 / 53. 32.100 libavdevice 53. 4.100 / 53. 4.100 libavfilter 2. 61.100 / 2. 61.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 6.100 / 0. 6.100 libpostproc 52. 0.100 / 52. 0.100 [mpegts @ 0x8540bc0] max_analyze_duration 5000000 reached at 5000000 [mpegts @ 0x8540bc0] PES packet size mismatch Input #0, mpegts, from 'Micmacs.m2t': Duration: 02:09:57.57, start: 54683.170644, bitrate: 2772 kb/s Program 1000 Stream #0:0[0xa1]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 15000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:1[0x51](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16, 192 kb/s Output #0, flac, to 'track1.flac': Metadata: encoder : Lavf53.32.100 Stream #0:0(eng): Audio: flac, 48000 Hz, stereo, s16, 128 kb/s Stream mapping: Stream #0:1 -> #0:0 (mp2 -> flac) Press [q] to stop, [?] for help

On Fri, Dec 28, 2012 at 8:08 PM, Anthony Hogan <anthony-luv@hogan.id.au>wrote:
Hi all,
I have a TV which has a built in USB record feature (which basically dumps DVB-T MPEG TS in 2GB chunks). I'd like to pull the audio track out of something I recorded. VLC happily plays the file and identifies the video, audio and EPG info in the transport stream, but if, for example, I run:
avconv -i ... -acodec copy audio.mp3
... I end up with about 2 seconds of silence.
It seems there's a couple of dummy streams and also that the overall file is prefixed with what looks like null garbage. I know that if vlc can play it, there's gotta be a way of extracting it, but must admit that I haven't had any luck thus far.
Any ideas on recommended tools for stubborn MPEG TS demuxing?
I use mencoder to convert files from our PVR to AVI, you should be able to just extract the audio, a little script I made for my wife to use to convert on her netbook is attached -- Mark "Pockets" Clohesy Mob Phone: (+61) 406 417 877 Email: hiddensoul@twistedsouls.com G-Talk: mark.clohesy@gmail.com - GNU/Linux.. Linux Counter #457297 "I would love to change the world, but they won't give me the source code" "Linux is user friendly...its just selective about who its friends are" "Never underestimate the bandwidth of a V8 station wagon full of tapes hurtling down the highway" "The difference between e-mail and regular mail is that computers handle e-mail, and computers never decide to come to work one day and shoot all the other computers"

It seems there's a couple of dummy streams and also that the overall file is prefixed with what looks like null garbage.
You could confirm this by running avprobe on the file.
$ avprobe .... avprobe version 0.8.4-6:0.8.4-0ubuntu0.12.10.1, Copyright (c) 2007-2012 the Libav developers built on Nov 6 2012 16:51:11 with gcc 4.7.2 [mpeg @ 0xf5b980] Format detected only with low score of 25, misdetection possible! [mp1 @ 0xf5c440] Header missing [mp1 @ 0xf5c440] Header missing [mp1 @ 0xf5c440] Header missing [mp1 @ 0xf5c440] Header missing [mp1 @ 0xf5c440] Header missing [mp1 @ 0xf5c440] Header missing [mp1 @ 0xf5c440] Header missing [mp1 @ 0xf5c440] Header missing [mpeg @ 0xf5b980] max_analyze_duration reached [NULL @ 0xf5c440] start time is not set in estimate_timings_from_pts Input #0, mpeg, from '....': Duration: 00:01:48.14, start: 2697.433633, bitrate: 3867 kb/s Stream #0.0[0x1d6]: Audio: mp1, 0 channels, s16 Stream #0.1[0x1c0]: Audio: mp3, 48000 Hz, stereo, s16, 256 kb/s $ avprobe -f mpegts .... avprobe version 0.8.4-6:0.8.4-0ubuntu0.12.10.1, Copyright (c) 2007-2012 the Libav developers built on Nov 6 2012 16:51:11 with gcc 4.7.2 ....: Operation not permitted $ avconv -i .... -acodec:0.1 copy audio.mp3 avconv version 0.8.4-6:0.8.4-0ubuntu0.12.10.1, Copyright (c) 2000-2012 the Libav developers built on Nov 6 2012 16:51:11 with gcc 4.7.2 [mpeg @ 0xf87960] Format detected only with low score of 25, misdetection possible! [mp1 @ 0xf89a80] Header missing Last message repeated 7 times [mpeg @ 0xf87960] max_analyze_duration reached [NULL @ 0xf89a80] start time is not set in estimate_timings_from_pts Input #0, mpeg, from '....': Duration: 00:01:48.14, start: 2697.433633, bitrate: 3867 kb/s Stream #0.0[0x1d6]: Audio: mp1, 0 channels, s16 Stream #0.1[0x1c0]: Audio: mp3, 48000 Hz, stereo, s16, 256 kb/s File 'audio.mp3' already exists. Overwrite ? [y/N] y Output #0, mp3, to 'audio.mp3': Metadata: TSSE : Lavf53.21.0 Stream #0.0: Audio: [0][0][0][0] / 0x0000, 48000 Hz, stereo, 256 kb/s Stream mapping: Stream #0:1 -> #0:0 (copy) Press ctrl-c to stop encoding size= 3384kB time=108.22 bitrate= 256.2kbits/s video:0kB audio:3384kB global headers:0kB muxing overhead 0.003723% The file I end up with is a silent MP3 of 3.4MB with a whole bucket load of streams in it still. Basically I'm of the opinion that an audio format is in there, I don't want to transcode it, I just want to demux it. Looking at the avconv output, it looks like it's taking the sample rate details from stream 0.0 and then using them for stream 0.1. Maybe I'm misreading this all? :) ... ffmpeg is a black art :)
participants (5)
-
Anthony Hogan
-
Geoff D'Arcy
-
Hiddensoul (Mark Clohesy)
-
Jason White
-
Steve Roylance