Jump to content

LIVE TV M3U Streams Breaking at Ad Breaks — Working Threadfin + FFmpeg Solution


Recommended Posts

Posted

This actually took hours of research and testing to get working.   I will attach a .docx (WORD) file with this report in it for easier use.

 

Emby Live TV Pluto Streams Breaking at Ad Breaks — Working Solution Using Threadfin + FFmpeg

I wanted to document a problem I was having with Pluto TV streams in Emby and the solution that finally worked.

Hopefully this saves somebody else the considerable amount of troubleshooting it took to isolate the problem.

The Problem

I run Emby Server on Windows and use M3U sources for Live TV.

The Pluto channels themselves would initially play correctly in Emby. The problem occurred whenever Pluto transitioned into or out of an advertising break.

The typical behavior was:

·         The channel starts normally.

·         The program plays normally.

·         Pluto reaches a commercial/ad break.

·         The stream freezes, stops, or otherwise becomes unusable.

·         Emby does not recover automatically.

·         The channel has to be refreshed or restarted manually.

·         The same problem can happen again at the next advertising transition.

This was particularly noticeable on channels containing Pluto's dynamically inserted advertisements.

The important distinction is that this was not simply a problem with Emby being unable to open the stream. The stream worked. The specific problem was Emby maintaining playback when the underlying HLS stream changed during Pluto's commercial transitions.

Test Environment

The configuration used while troubleshooting was:

·         Windows 11 Pro

·         Emby Server 4.10.1.0

·         Emby Premiere

·         Threadfin 1.2 Build 37

·         Threadfin running on the same Windows PC as Emby Server

·         Threadfin configured to use FFmpeg

·         Emby's bundled FFmpeg executable used by Threadfin

·         Pluto TV M3U source

·         Pluto TV XMLTV/EPG source

The actual Pluto M3U and XMLTV source URLs have intentionally been removed from this post.

Whenever one of those source URLs would normally appear, it is represented as:

<your source m3u here>

Download Threadfin

Threadfin can be downloaded from its official GitHub releases page:

https://github.com/Threadfin/Threadfin/releases

Download the appropriate release for your operating system.

For this setup I was using Windows, so I used the Windows AMD64 version.

What We Tested Before Finding the Solution

1. Direct M3U Into Emby

The original configuration was essentially:

Pluto M3U
    ↓
Emby

This worked for normal playback.

The problem occurred when Pluto transitioned into or out of commercials.

At one of these transitions, the stream could stop and Emby would fail to recover without manually restarting the channel.

2. Separate HLS Proxy

We also tested a separate HLS proxy between the source and Emby.

The path looked approximately like:

Pluto
   ↓
HLS Proxy
   ↓
Emby

That particular proxy did not solve the advertising-transition problem in our configuration, so it was removed.

That does not necessarily mean every HLS proxy will fail. It simply did not solve this particular problem during our testing.

3. VLC Testing

VLC turned out to be extremely useful for diagnosing what was happening.

At one point, we opened one of the Pluto streams and saw the repeating animated Pluto screen.

Initially it appeared that the stream was stuck in an endless loop.

Instead of closing VLC, we left the stream running.

Eventually, the actual movie resumed.

That was an important discovery.

The repeating Pluto animation was not necessarily evidence that the stream had permanently failed. It could instead be part of Pluto's advertising/slate period.

This helped distinguish between a genuinely dead stream and a stream that was temporarily showing Pluto's advertising/slate content.

That changed the direction of the troubleshooting.

The Working Solution

The configuration that finally solved the playback problem was:

Pluto M3U
    ↓
Threadfin
    ↓
FFmpeg Buffer
    ↓
Emby

The guide data is handled separately:

Pluto XMLTV
    ↓
Emby

This separation ended up being important. Threadfin handles the video streams, while Emby receives the EPG/guide data separately.

Step 1 — Install Threadfin

Download Threadfin from:

https://github.com/Threadfin/Threadfin/releases

Install or extract the version appropriate for your operating system and start Threadfin.

In this setup, Threadfin and Emby Server are running on the same Windows computer.

Because they are on the same computer, localhost/loopback addresses can be used between them.

The Threadfin interface will normally be available at something similar to:

http://127.0.0.1:<THREADFIN-PORT>/

Use the actual port assigned to your Threadfin installation.

Step 2 — Add Your Pluto Playlist to Threadfin

Open Threadfin.

Go to: Playlist

Create a new M3U playlist.

For the Pluto M3U source, enter:

<your source m3u here>

Use only M3U and XMLTV sources that you are legally authorized to access and use. This guide does not provide or endorse any particular stream provider or playlist source.

The actual source used during testing has intentionally been removed from this post.

Step 3 — Configure FFmpeg Buffering

This was one of the most important parts of the solution.

Configure Threadfin to use: Buffer: FFmpeg

Threadfin requires access to FFmpeg for this configuration. Configure Threadfin with an appropriate FFmpeg installation for your operating system according to Threadfin's documentation.

The important part is that the working configuration was:

Pluto HLS Stream
       ↓
Threadfin
       ↓
FFmpeg Buffer
       ↓
Emby

Do not disable the FFmpeg buffer after getting the setup working.

This appears to be the component that allows Emby to receive a more stable continuous stream while Pluto changes segments around advertising transitions.

Step 4 — Add Your XMLTV Source to Threadfin

We also added the Pluto XMLTV source to Threadfin during configuration.

In Threadfin, add your XMLTV/EPG source.

For purposes of this post, that source is represented as:

<your source m3u here>

Again, the actual source URL has intentionally been removed.

Threadfin can use the XMLTV information while organizing/mapping the channels. However, as explained later, we ultimately did not use Threadfin's generated XMLTV file as the final guide source inside Emby.

Step 5 — Select the Channels You Want in Threadfin

Go to: Threadfin → Mapping

Select the channels you want Threadfin to export.

This is an area where some care is required. Threadfin's Mapping/Bulk Edit interface can be confusing.

The checkboxes on the left side are used to select channels for editing. Selecting a checkbox does not necessarily mean the channel has already been properly activated and exported.

After selecting your channels:

1.  Make sure the channels you want are marked Active.

2.  Make the required mapping changes.

3.  Finish the edit window.

4.  Click the main Save button on Threadfin's Mapping page.

5.  Give Threadfin time to rebuild its playlist.

Important Warning About Bulk XMLTV Mapping

Be careful when using Threadfin's Bulk Edit function.

During troubleshooting, we accidentally assigned the same XMLTV channel to a large number of unrelated channels.

The result was that completely different channels could appear to have the same television programs in Emby's guide.

For example, unrelated movie, television, news, and other channels could all inherit the same guide information.

If this happens, check your Threadfin XMLTV mappings.

Do not bulk-assign one XMLTV channel ID to hundreds of different television channels.

Step 6 — Verify Threadfin's Generated M3U

Once your channels have been activated, Threadfin generates its own M3U playlist.

For a local installation, the address follows this format:

http://127.0.0.1:<THREADFIN-PORT>/m3u/threadfin.m3u

Open that URL in a browser or text editor.

You should see channel entries that look approximately like:

#EXTINF:0 ... tvg-name="Pluto TV Horror" ...
http://127.0.0.1:<THREADFIN-PORT>/stream/<STREAM-ID>

This is important. Emby will no longer be receiving the upstream Pluto stream directly. Instead, Emby receives Threadfin's local stream URL.

Conceptually:

Upstream Pluto URL
        ↓
Threadfin
        ↓
Local Threadfin /stream/ URL
        ↓
Emby

Do not publicly post:

·         Signed provider stream URLs

·         Authentication information

·         API tokens

·         Session IDs

·         Account credentials

·         Private playlist URLs

Step 7 — Add Threadfin to Emby

Open: Emby Server Dashboard → Live TV

Choose: Add TV Source → M3U

For the M3U URL, enter Threadfin's generated playlist:

http://127.0.0.1:<THREADFIN-PORT>/m3u/threadfin.m3u

If Emby and Threadfin are installed on different computers, you will need to use the appropriate network IP address instead of 127.0.0.1.

Our Final Emby M3U Settings

The working M3U tuner configuration in Emby was:

M3U URL

http://127.0.0.1:<THREADFIN-PORT>/m3u/threadfin.m3u

Other settings:

·         User Agent HTTP Header: blank

·         Referer Header Mode: Both

·         Referer HTTP Header: blank

·         Simultaneous Stream Limit: 1

·         Only import channels containing these groups: blank

·         Import guide directly from M3U: unchecked

·         Preferred channel image source: Guide Data Source

·         Allow mapping to guide data using channel numbers: unchecked

·         Tags: optional

During troubleshooting, we accidentally ended up with two Emby M3U TV sources pointing to the exact same Threadfin playlist.

Once everything was working, the duplicate source was removed.

The final configuration contains only one Threadfin M3U TV source.

Step 8 — Test Playback Before Working on the Guide

Before worrying about guide data, verify that the streams work.

Pick a Pluto channel that is likely to encounter advertisements.

We used: Pluto TV Horror

Start the channel through Emby. Then leave it running. Do not manually refresh it when an advertising break begins.

Our Ad-Break Test

This was the test that confirmed the solution.

The sequence was approximately:

1.  Start Pluto TV Horror in Emby.

2.  The movie begins normally.

3.  Pluto reaches an advertising break.

4.  We leave the stream alone.

5.  Pluto displays advertising/slate material.

6.  The movie resumes automatically.

7.  Another advertising break occurs.

8.  Emby stays connected.

9.  Programming resumes again.

10.  The channel later transitions into another movie without requiring a manual refresh.

We also observed actual Pluto advertisements rather than only the Pluto animated slate.

The important result was: Emby survived multiple Pluto advertising transitions without requiring the Live TV stream to be manually restarted.

That was the exact problem we were trying to solve.

Why Threadfin + FFmpeg Appears to Work

I do not want to claim that we identified the exact internal cause of the failure inside Emby.

What we were able to demonstrate through testing is:

Direct playback:

Pluto HLS
    ↓
Emby

could fail when the stream changed around Pluto advertising transitions.

Buffered playback:

Pluto HLS
    ↓
Threadfin
    ↓
FFmpeg
    ↓
Emby

continued playing.

Based on those observations, Threadfin plus FFmpeg appears to provide Emby with a more stable continuous stream while the upstream HLS playlist changes during advertisements.

That is an observed result from testing rather than a claim about the exact underlying Emby bug.

Guide Data Was a Separate Problem

Once the playback issue was solved, we still had to fix the program guide.

Initially, we tried using Threadfin's generated XMLTV output in Emby.

Threadfin provides a local XMLTV URL similar to:

http://127.0.0.1:<THREADFIN-PORT>/xmltv/threadfin.xml

During our testing, this did not give us satisfactory guide results.

At one point, unrelated channels were showing the same programs.

We eventually discovered that some of that was caused by incorrect XMLTV mappings created during bulk editing.

We also inspected Threadfin's generated XMLTV.

There were situations where a channel definition existed but corresponding <programme> data was not appearing as expected.

Rather than continuing to troubleshoot Threadfin's generated EPG output, we separated the two functions.

Final Guide Solution

Threadfin remains responsible for video playback.

Emby receives the XMLTV guide directly.

So instead of using:

http://127.0.0.1:<THREADFIN-PORT>/xmltv/threadfin.xml

as the final Emby guide source, we added our Pluto XMLTV source directly to Emby.

The actual XMLTV URL is intentionally censored.

Use:

<your source m3u here>

Step 9 — Add the Guide Directly to Emby

Go to: Emby Server Dashboard → Live TV → Guide Data Sources

Choose: Add Guide Data Source

Select: XML TV

For the XMLTV URL, enter:

<your source m3u here>

Then configure it approximately as follows:

·         XMLTV URL: <your source m3u here>

·         User Agent: blank

·         Keep the normal Emby category settings unless you specifically need to modify them

·         Enable the guide source for the appropriate tuner/device

·         Save

Then run: Refresh Guide Data

Allow Emby time to download and process the EPG.

Guide Results

After moving the XMLTV source directly into Emby, the guide began showing sensible program information for individual channels.

During testing, examples included channels such as:

·         Pluto TV Trending Now

·         Pluto TV Spotlight

·         Pluto TV Franchise Favorites

·         Pluto TV Icons

·         Pluto TV Action

·         Pluto TV Comedy

·         Pluto TV Romance

·         Pluto TV Crime Movies

·         Pluto TV Thrillers

·         Pluto TV Horror

Instead of unrelated channels showing duplicated guide information, the channels now displayed their own appropriate programming.

Final Working Architecture

VIDEO

<your source m3u here>
          ↓
       Threadfin
          ↓
     FFmpeg Buffer
          ↓
Threadfin Generated M3U
          ↓
         Emby
          ↓
      Live TV Client

Threadfin's local M3U looks like:

http://127.0.0.1:<THREADFIN-PORT>/m3u/threadfin.m3u

GUIDE

<your source m3u here>
          ↓
         Emby
          ↓
     Program Guide

The guide does not need to travel through Threadfin in the final configuration.

Final Emby Configuration

In the end, our Emby Live TV configuration contains:

One M3U TV source

http://127.0.0.1:<THREADFIN-PORT>/m3u/threadfin.m3u

One XMLTV guide source

<your source m3u here>

There are no duplicate Threadfin tuners.

The direct upstream Pluto M3U is not added separately to Emby.

Final Threadfin Configuration

Threadfin contains:

Pluto M3U source

<your source m3u here>

Pluto XMLTV source

<your source m3u here>

Buffer

FFmpeg

Threadfin then exports the selected channels to:

http://127.0.0.1:<THREADFIN-PORT>/m3u/threadfin.m3u

That generated playlist is what Emby uses for video.

What Not to Do

Based on our troubleshooting, I would avoid the following:

·         Do not feed both the direct Pluto playlist and the Threadfin playlist into Emby for the same channels.

·         Do not leave duplicate Threadfin M3U tuners in Emby.

·         Do not disable the FFmpeg buffer after getting this configuration working.

·         Do not automatically assume the repeating Pluto animation means the stream has permanently failed.

·         Do not repeatedly restart the stream during an advertising slate before giving it time to resume.

·         Do not bulk-assign one XMLTV channel to hundreds of unrelated channels.

·         Do not enable channel-number guide matching unless your configuration actually requires it.

·         Do not publicly post authenticated, signed, private, or tokenized stream URLs.

·         Do not post provider credentials.

·         Do not assume the video source and guide source have to take the same route into Emby.

Separating video delivery from guide delivery turned out to work much better for us.

Troubleshooting Method

Test 1

Open your upstream stream in VLC:

Source
  ↓
VLC

See whether it survives an advertising transition.

Test 2

Open the Threadfin version of the same channel in VLC:

Source
  ↓
Threadfin
  ↓
FFmpeg
  ↓
VLC

Leave the stream running through an advertising break.

Test 3

Then test:

Source
  ↓
Threadfin
  ↓
FFmpeg
  ↓
Emby

This helps determine exactly which layer is causing the failure.

Threadfin Logs Are Very Useful

Threadfin's log helped confirm what was happening.

During successful playback we could see Threadfin:

·         Opening the upstream stream

·         Starting FFmpeg

·         Receiving data

·         Buffering the stream

·         Providing the resulting stream to the client

If the upstream stream continues but Emby fails when accessing it directly, testing Threadfin with FFmpeg buffering is worthwhile.

One Important Lesson From the Pluto Holding Screen

Do not automatically assume the stream is broken when you see Pluto's animated screen repeating.

During our testing, we initially thought the stream was stuck.

We left it running.

Eventually, the scheduled programming resumed normally.

In our case, that screen was occurring during Pluto's ad/slate period.

This distinction became very important while diagnosing the original Emby problem.

The Result

After changing the video path to:

Pluto
  ↓
Threadfin
  ↓
FFmpeg
  ↓
Emby

the channel survived multiple Pluto advertising transitions.

After separately providing the XMLTV data directly to Emby, the program guide also populated correctly.

We now have:

·         Working Pluto Live TV channels in Emby

·         Working channel logos

·         Working guide information

·         FFmpeg buffering through Threadfin

·         Streams that survive Pluto advertising breaks

·         No need to manually refresh the channel after each ad break

The final configuration has been stable through the tests we performed.

Useful Link

Threadfin releases:

https://github.com/Threadfin/Threadfin/releases

All Pluto source URLs in this post have deliberately been replaced with:

<your source m3u here>

Use your own authorized M3U/XMLTV sources.

Hopefully this helps anyone running into the same Emby Live TV problem.

Emby_Threadfin_Pluto_Solution_Report.docx

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...