Skip to content

Instantly share code, notes, and snippets.

@windyinsc
Created March 19, 2017 00:12
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • 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.

@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