Ticket #46 (closed defect: fixed)

Opened 12 years ago

Last modified 9 years ago

Problems using flutsdemux with dvbsrc

Reported by: andreas@… Owned by: jan@…
Priority: normal Milestone:
Component: gst-fluendo-mpegdemux Version:
Severity: major Keywords:
Cc:

Description

I've tried as many different ways I could think of how to use flutsdemux, but none of them give any useful results. I'll describe my different tests below....

First a little background. I'm trying to use gstreamer for viewing DVB-T broadcasts with my new Megasky usb stick. I'm using the "dvbsrc" element to capture data. Unfortunately I can't link dvbsrc directly to ffdemux_mpegts because it doesn't support push mode. I was told to use flutsdemux which was supposed to be the new an supported MPEG TS demuxer. (Why is it under a non-free license? Wasn't gstreamer supposed to use (L)GPL och BSD?)

Anyway... using this pipeline which should play a local channel ("SVT1") directly off the stick, gives me 1 frame/sec and no audio:

gst-launch-0.10 dvbsrc modulation="QAM 64" trans-mode=8k bandwidth=8 freq=626000000 code-rate-lp=2/3 code-rate-hp=1/2 guard=8 hierarchy=NONE pids=1019:1018 ! flutsdemux es-pids=1019:1018 name=demuxer demuxer. ! queue ! flump3dec ! audioconvert ! pulsesink demuxer. ! queue ! mpeg2dec ! autovideosink -t

Trying the same thing but without specifying a specific channel in the TS (seems it just picks one channel in the TS to play if you do this), gives me good video but still no audio:

gst-launch-0.10 dvbsrc modulation="QAM 64" trans-mode=8k bandwidth=8 freq=626000000 code-rate-lp=2/3 code-rate-hp=1/2 guard=8 hierarchy=NONE ! flutsdemux name=demuxer demuxer. ! queue ! flump3dec ! audioconvert ! pulsesink demuxer. ! queue ! mpeg2dec ! autovideosink -t

So... best option: I can get good video, but I'm not able to specify channel. Moving over to capturing the TS to file and playing from there to isolate the cause....

Capturing "SVT1" with this command: gst-launch-0.10 dvbsrc modulation="QAM 64" trans-mode=8k bandwidth=8 freq=626000000 code-rate-lp=2/3 code-rate-hp=1/2 guard=8 hierarchy=NONE pids=1019:1018 ! filesink location=data/svt1.ts

File available here (14MB):  http://gamezone.fatal.se/~gem/dvb/data/svt1.ts

Playing this file with fluts, gives me good video choppy (comes and goes, lots of noise) audio:

gst-launch-0.10 filesrc location=data/svt1.ts ! flutsdemux es-pids=1019:1018 name=demuxer demuxer. ! queue ! flump3dec ! audioconvert ! pulsesink demuxer. ! queue ! mpeg2dec ! autovideosink -t

Since we now have files, playing with ffdemux_mpegts can be compared and works perfectly: gst-launch-0.10 filesrc location=data/svt1.ts ! ffdemux_mpegts name=demuxer demuxer. ! queue ! flump3dec ! audioconvert ! pulsesink demuxer. ! queue ! mpeg2dec ! autovideosink -t

Current status: I can capture to disk and play it using ffmpeg's demuxer, but not directly from the stick. This could work if it was not for some weird time/space paradox, where when you play from file it catches up to the capture. WTF?!?!?!?!!

As another testing point I also captured the whole TS (no specific channel/pids) using:

gst-launch-0.10 dvbsrc modulation="QAM 64" trans-mode=8k bandwidth=8 freq=626000000 code-rate-lp=2/3 code-rate-hp=1/2 guard=8 hierarchy=NONE ! filesink location=data/full.ts

Sample file available here (85MB):  http://gamezone.fatal.se/~gem/dvb/data/full.ts

Playing this with flutsdemux hangs on PREROLLING, no matter if I specify es-pids or leave them out...

The same file plays without problems (and picks a "random" channel in the TS) using ffdemux_mpegts....

Current status: no change.... I'm still fucked.

Best so far is to use "mplayer  dvb://", since that only fucks up when I change channel (which makes the UI dissapear, and sometimes it doesn't return so I have to kill MPlayer and start over again).

Watching DVB seemed to be so close with gstreamer, but apparently there's still some work needed to actually make it usable.

I hope the test files I've provided helps someone who can debug this hunt the problems down and kill them. Feel free to contact me for any additional info you might need: andreas at fatal.se

Attachments

gst-inspect-output.txt Download (24.3 KB) - added by andreas@… 12 years ago.
gst-inspect output on my system.

Change History

Changed 12 years ago by andreas@…

gst-inspect output on my system.

  Changed 12 years ago by andreas@…

Oops... please excuse my foul language. No excuse, but I've been pulling my hair for some time trying to solve this and feel a bit desperate right now.

I found another angle that might be interesting as well....

Dumping audio to disk seems to produce correct audio (which can be played later without problems): gst-launch-0.10 filesrc location=data/svt1.ts ! flutsdemux es-pids=1019:1018 name=demuxer demuxer. ! queue ! filesink location=/tmp/foo.mp3 demuxer. ! queue ! mpeg2dec ! autovideosink -t

This would again suggest that it's not flutsdemux who is causing it, and it could be anywhere?!

Regards, Andreas

  Changed 12 years ago by zaheer

  • summary changed from flutsdemux totally unusable to Problems using flutsdemux with dvbsrc

ok firstly the es-pids option for flutsdemux is only there for the case where someone has recorded a transport stream without pat and pmt.

secondly crafting manual pipelines with default size queues will break with transport streams, because of the very small sized packets so will run into the default max buffers in queue so using queue max-size-buffers=0 max-size-time=0 is preferred

ffdemux_ts is not that great, so not even worth trying to use that

if you use dvbsrc then the pat will always be included

you need to just specify the pmt for the program you want to watch in the pids parameter for dvbsrc as well as the video and audio stream pids

however i have written some python that will work the pids of the pmt, and the elementary streams solely when given a program number

the transport stream demuxer has certain read-only properties: pat-info and pmt-info which an app can listen to changes on and therefore get data about the stream

 https://core.fluendo.com/flumotion/trac/browser/flumotion-dvb/trunk/flumotion/component/dvb/dvbbin.py is that python program but i have added infrastructure in there that will be used when changing program etc. so the pipeline can be re-used...i haven't tested this recently but it will give you an idea

  Changed 12 years ago by anonymous

I've added the queue options, added the program number (1010) to pids, and removed the es-pids... I can now stream directly from dvbsrc with proper framerate for video - still no audio though. :(

Here's the latest pipeline I've come up with: gst-launch-0.10 dvbsrc modulation="QAM 64" trans-mode=8k bandwidth=8 freq=626000000 code-rate-lp=2/3 code-rate-hp=1/2 guard=8 hierarchy=NONE pids=1010:1019:1018 ! flutsdemux name=demuxer demuxer. ! queue max-size-buffers=0 max-size-time=0 ! flump3dec ! audioconvert ! pulsesink demuxer. ! queue max-size-buffers=0 max-size-time=0 ! mpeg2dec ! autovideosink

The channels.conf file for the same line looks like this: SVT1:626000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_8:HIERARCHY_NONE:1019:1018:1010

I've been playing around with your dvbbin.py script, but unfortunately I haven't figured out how to properly replace your fakesink for audio with both audioconvert and pulsesink to get audio output.... it gives me proper video though....

I'll keep trying to get the script working... if you have any more hints for me they would be greatly appreciated!

Regards, Andreas Henriksson

follow-up: ↓ 5   Changed 12 years ago by anonymous

add sync=false to the sinks should make the video and audio play.

in reply to: ↑ 4 ; follow-up: ↓ 7   Changed 12 years ago by andreas@…

autovideosink didn't have any sync option, but adding it to the audio sink (pulsesink) I now get both video and audio!

gst-launch-0.10 dvbsrc modulation="QAM 64" trans-mode=8k bandwidth=8 freq=626000000 code-rate-lp=2/3 code-rate-hp=1/2 guard=8 hierarchy=NONE pids=1010:1019:1018 ! flutsdemux name=demuxer demuxer. ! queue max-size-buffers=0 max-size-time=0 ! flump3dec ! audioconvert ! pulsesink sync=false demuxer. ! queue max-size-buffers=0 max-size-time=0 ! mpeg2dec ! autovideosink

Feels like success! Although, audio is heavily lagged (which I guess is no surprise when you disable sync)....

Why doesn't sync work? In which component is the problem located? Are anyone working on solving it?

Thanks for all help! I guess it's time to start hacking on a real application now....

Regards, Andreas Henriksson

  Changed 12 years ago by anonymous

I'm also seeing the same problems as yourself. When trying to playback a recorded transport stream from a filesrc I have to set sync=false to get any audio, then with this set I get a low framerate.

I can't use ffdemux_mpegts because I need to use it in push mode and get data from an fdsrc - someone is working on adding push mode support to ffdemux_mpegts, but presently it's non-functional.

I'd like to help debug the sync issue with flutsdemux as presently there is no way to play-back an MPEG2 transport stream in push mode with GStreamer at an acceptable quality.

in reply to: ↑ 5   Changed 12 years ago by jan

Replying to andreas@fatal.se:

Why doesn't sync work? In which component is the problem located? Are anyone working on solving it?

Sync in the video/audio outputs doesn't work because the pipeline is a 'live' pipeline - data is always being fed in and output at a constant rate. The problem this causes is that audio and video are always arriving late at the sinks, because they cannot arrive earlier than they get fed into the pipeline. For video, the sink will output the frames if they're less than half a frame period late, but the audiosink is not so forgiving and just drops all the output.

Handling this case properly requires some extra functionality in GStreamer that's only being added in the 0.10.13 releases of Core & Base, which should be out this week.

Once those releases are out, we need 2 things added to flutsdemux, and it should all work correctly. The two things to go in flutsdemux are:

  • Handle the LATENCY query and report a latency that compensates for muxing offset between the video and audio.
  • When running from a live feed, use the PCR in the input stream to synthesise a clock.

We have a patch for the first item, and Zaheer is working on the 2nd, so it shouldn't be too much longer.

  Changed 11 years ago by zaheer

  • status changed from new to closed
  • resolution set to fixed

All issues here are now resolved. Try 0.10.15 of gst-fluendo-mpegdemux.

Note: See TracTickets for help on using tickets.