Skip to content

Instantly share code, notes, and snippets.

@windyinsc
Created March 19, 2017 00:12
Show Gist options
  • Save windyinsc/71b10a7f6b0f9b603af913ad01474539 to your computer and use it in GitHub Desktop.
Save windyinsc/71b10a7f6b0f9b603af913ad01474539 to your computer and use it in GitHub Desktop.
Fix for VLC: ts error: libdvbpsi error (PSI decoder): TS duplicate

FIX FOR VLC ERROR BELOW

The following changes to VLC were successful in fixing all playback issues.

  • VLC Version 2.2.4 Weatherwax (Intel 64bit) on OS X 10.9

ISSUE:

ts error: libdvbpsi error (PSI decoder): TS duplicate (received 0, expected 1) for PID 0 ts error: libdvbpsi error (PSI decoder): TS duplicate (received 0, expected 1) for PID 4095

THE FIX:

Tools > Preferences > Input/Codecs > Demuxers > MPEG-TS:

  • Disable 'Trust in-stream PCR'
  • Check Seek based on percent not time

After making changes to both options above, all files (both sound and video) now play successfully.

@sucrose
Copy link

sucrose commented Oct 10, 2017

Thank you, it works. 👍

@cvcore
Copy link

cvcore commented Oct 29, 2017

thanks!

@rsmaior
Copy link

rsmaior commented Apr 30, 2018

Worked on Ubuntu too. Thanks!

@RDJ16
Copy link

RDJ16 commented May 24, 2018

Thank you very much

@vedantlodha
Copy link

can you post command to do that on cli, please.

@ivanhuay
Copy link

ivanhuay commented Aug 8, 2018

👍

@findmory
Copy link

anyone know how to do this from the vlc cli?

@ieaster1
Copy link

As a passer-by, the following options may be used for CLI:
--no-ts-trust-pcr -- This will Disable the Trust in-stream PCR option
--ts-seek-percent -- Enables Seek based on percentage

Source: https://wiki.videolan.org/VLC_command-line_help

@dualfade
Copy link

good man. That's how I do it as well ;)

kubernetes on  master via -> v1.10.3 took 4m 28s
➜ cat ~/.zshrc | ag vlc
alias vlc_wpaper='/usr/bin/vlc -I dummy --video-wallpaper --fullscreen --equalizer-preset=rock --no-ts-trust-pcr --ts-seek-percent --play-and-exit '
alias vlc_nwpaper='/usr/bin/vlc -I dummy --no-video --equalizer-preset=rock --no-ts-trust-pcr --ts-seek-percent --play-and-exit '
kubernetes on  master via -> v1.10.3

@khyatiChitroda
Copy link

Hi can you please help me out, I am getting this same error in android SDK, what should I do for this?

@jaskiew
Copy link

jaskiew commented Nov 25, 2019

#windows7
For me change of preferences was not enough and I was reciving still the same error (I was opening multicast stream). I spent few hours looking for solution but found nothing, in my case the network card was not able to handle amount of data and after changing external USB network card to bulit-in PCIe card everything started working fine.
Regards

@ArcticSpaceFox
Copy link

There is no option Demuxers for me, but I get the same error. Has something changed?

@LukeBorowy
Copy link

@ArcticSpaceFox And also anyone else seeing this now:

To see the Demuxers option you need to change the option "Show Settings" in the lower left side of the preferences window from "Simple" to "All". Then you can see the Demuxers option.

That is how you change the setting, but unfortunately it did not work to fix the problem, at least not for me.

@Dragod
Copy link

Dragod commented Feb 22, 2021

options change didn't work for me@
image

@vivi90
Copy link

vivi90 commented Apr 20, 2021

options change didn't work for me
Yes, me too :-(

[vivien@vivien-nb Projekte]$ python test.py
watch?v=zLAfTaCFXk4
0:00:00
[00007f5928001630] http stream error: local stream 1 error: Cancellation (0x8)
[00007f5928001630] http stream error: local stream 1 error: Cancellation (0x8)
[00007f59284f88e0] http stream error: local stream 1 error: Cancellation (0x8)
[00007f59284f88e0] http stream error: local stream 1 error: Cancellation (0x8)
watch?v=zLAfTaCFXk4
0:00:00
Cyberpunk 2077 Radio 24/7 by NightmareOwl (Electro/Cyberpunk/Midtempo)
0:00:00
[00007f59285ddba0] adaptive demux: Changing stream format Unknown -> Unknown
[00007f59285ddba0] adaptive demux: Encountered discontinuity
[00007f59285e17f0] main decoder error: buffer deadlock prevented
[00007f592808c8e0] mpeg4audio packetizer: AAC channels: 2 samplerate: 22050
Cyberpunk 2077 Radio 24/7 by NightmareOwl (Electro/Cyberpunk/Midtempo)
11:31:34
Cyberpunk 2077 Radio 24/7 by NightmareOwl (Electro/Cyberpunk/Midtempo)
11:31:35
Cyberpunk 2077 Radio 24/7 by NightmareOwl (Electro/Cyberpunk/Midtempo)
11:31:36
[00007f592c001610] ts demux error: libdvbpsi error (PSI decoder): TS duplicate (received 0, expected 1) for PID 0
[00007f592c001610] ts demux error: libdvbpsi error (PSI decoder): TS duplicate (received 0, expected 1) for PID 4095
[00007f592c001610] ts demux error: libdvbpsi error (PSI decoder): TS duplicate (received 0, expected 1) for PID 0
[00007f592c001610] ts demux error: libdvbpsi error (PSI decoder): TS duplicate (received 0, expected 1) for PID 4095
[00007f592c001610] ts demux error: libdvbpsi error (PSI decoder): TS duplicate (received 0, expected 1) for PID 0
[00007f592c001610] ts demux error: libdvbpsi error (PSI decoder): TS duplicate (received 0, expected 1) for PID 4095
Cyberpunk 2077 Radio 24/7 by NightmareOwl (Electro/Cyberpunk/Midtempo)
11:31:36
#!/usr/bin/env python3
import vlc
import time
import datetime

instance = vlc.Instance("--no-ts-trust-pcr", "--ts-seek-percent", "--no-video")

# Create a media player with the default instance
player = instance.media_list_player_new()

# Load the media file
media = instance.media_list_new(["https://www.youtube.com/watch?v=zLAfTaCFXk4"])
player.set_media_list(media)

player.play()
while player.get_state() != vlc.State.Ended:
    print(player.get_media_player().get_media().get_meta(0))
    print(str(datetime.timedelta(seconds=player.get_media_player().get_time() / 1000, microseconds=0)).split(".")[0])
    time.sleep(1)

@Gormezoglu
Copy link

This options is not valid for m3u users. Demux is not comply with m3u playlists. At least I have faced that problem. fyi

@scrappyG
Copy link

scrappyG commented Apr 16, 2023

Running the following: VLC Version 3.0.18 (Intel 64bit) on macOS Ventura 13.5.2.
I was streaming a m3u8 file from the internet made of 3 second media clips.

But, oh my god. After literally spending hours combing forums across multiple search terms, I've finally found the fix for me. Now I don't know 100% of the roots of OP's problem, so my fix may or may not be a solution for everyone reading, but OP's fix failed to address the ts error's in the VLC logs for me (in addition to the audio cutting out every 3 seconds), so I was pretty disappointed...until I happened to disable the "Check packets continuity counter" option under

VLC Media Player > Settings > Click the "Show All" button (at bottom) > Input/Codecs > Demuxers > MPEG-TS:

Results: The "libdvbpsi error"'s didn't go away (which btw, are the same 3 PIDs in my case), but the video stuttering and choppy playback DID :)

Hopefully this works for you all too!
Screenshot 2023-09-26 at 1 32 09 AM

@MATPOCKIH
Copy link

Check packets continuity counter

Thank you so much. My HLS via https doesn't stuck now.
I've added --no-ts-cc-check option in LibVLC initialization

@scrappyG
Copy link

Check packets continuity counter

Thank you so much. My HLS via https doesn't stuck now. I've added --no-ts-cc-check option in LibVLC initialization

Alright! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment