• Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below
  • Forum
  • Website
  • GitHub
  • Status
  • Translation
  • Features
  • Team
  • Rules
  • Help
  • Feeds
User Links
  • Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below

    Useful Links Forum Website GitHub Status Translation Features Team Rules Help Feeds
    Jellyfin Forum Support General Questions Comskip and Media Segments

     
    • 0 Vote(s) - 0 Average

    Comskip and Media Segments

    AustinL
    Offline

    Junior Member

    Posts: 9
    Threads: 1
    Joined: 2025 Jan
    Reputation: 0
    Country:United Kingdom
    #18
    2025-04-02, 10:35 AM
    All in Visual Basic, I'm afraid... I'm such an amateur.

    First, a few constants:

    Code:
            Const MyServer = "http://localhost:8096"
            Const PathToComSkip = "C:\ComSegments\comskip\comskip.exe"
            Const PathToComSkipINI = "C:\ComSegments\comskip\comskip.ini"
            Const AuthToken = "MediaBrowser Token=""MyAPIToken"""
            Const ProviderID = "Chapter Segments Provider"
            Const ComskipEDLFile = "C:\ComSegments\working\tmp.edl"

    Next, Analyse the media file with Comskip and generate EDL file:

    Code:
            Dim psi As ProcessStartInfo
            Dim p As Process

            psi = New ProcessStartInfo(PathToComSkip)
            psi.ArgumentList.Add(FileToAnalyse)
            psi.ArgumentList.Add("--ini=" & PathToComSkipINI)
            p = Process.Start(psi)
            p.WaitForExit()


    And finally, mark the media segments:

    Code:
            Dim lines = File.ReadAllLines(ComskipEDLFile)
            Dim LineParts() As String

            For Each line In lines
                LineParts = line.Split(vbTab)
                ms = New MediaSegment
                ms.Id = Guid.NewGuid
                ms.ItemId = Guid.Parse(ItemId)
                ms.Type = MediaSegmentType.Commercial
                ms.StartTicks = LineParts(0) * 10000000
                ms.EndTicks = LineParts(1) * 10000000
                h = New StringContent(JsonConvert.SerializeObject(ms), Encoding.UTF8, "application/json")
                Await Client.PostAsync(MyServer & "/MediaSegmentsApi/" & Guid.Parse(ItemId).ToString & "?providerId=" & ProviderID, h)
            Next


    I'm still running this manually because I can't find a way of getting the ID of an item from the recording post processing command, but actually that's OK for me because only a few programmes that I record are on commercial TV.  I'm happy with it for my purposes, no need for any muxing, converting, creating chapters, or deleting - it doesn't even touch the source file.  If anyone is interested in taking the idea and making it into a plugin, that would be wonderful (not me, I don't have the skills or the patience), and it would be really cool if the Jellyfin geniuses could expand the native Media Segments API to allow creation and deletion and avoid the need to use the third party Media Segments API plugin.

    And my wife is happy because she now gets a "Skip Ads" button when she watches her favourite soaps :-)

    Many thanks to TheDreadPirate and esvee for pointing me in the right direction!

    Austin
    « Next Oldest | Next Newest »

    Users browsing this thread: 1 Guest(s)


    Messages In This Thread
    Comskip and Media Segments - by AustinL - 2025-03-19, 01:42 PM
    RE: Comskip and Media Segments - by TheDreadPirate - 2025-03-19, 02:07 PM
    RE: Comskip and Media Segments - by AustinL - 2025-03-20, 10:35 AM
    RE: Comskip and Media Segments - by TheDreadPirate - 2025-03-20, 02:22 PM
    RE: Comskip and Media Segments - by AustinL - 2025-03-21, 12:47 PM
    RE: Comskip and Media Segments - by TheDreadPirate - 2025-03-21, 01:17 PM
    RE: Comskip and Media Segments - by AustinL - 2025-03-21, 01:41 PM
    RE: Comskip and Media Segments - by TheDreadPirate - 2025-03-21, 01:52 PM
    RE: Comskip and Media Segments - by AustinL - 2025-03-21, 10:56 PM
    RE: Comskip and Media Segments - by esvee - 2025-03-25, 07:11 AM
    RE: Comskip and Media Segments - by esvee - 2025-03-25, 07:19 AM
    RE: Comskip and Media Segments - by TheDreadPirate - 2025-03-25, 01:45 PM
    RE: Comskip and Media Segments - by esvee - 2025-03-25, 03:25 PM
    RE: Comskip and Media Segments - by AustinL - 2025-03-31, 11:00 PM
    RE: Comskip and Media Segments - by TheDreadPirate - 2025-04-01, 01:27 PM
    RE: Comskip and Media Segments - by AustinL - 2025-04-01, 07:16 PM
    RE: Comskip and Media Segments - by AustinL - 2025-04-01, 07:29 PM
    RE: Comskip and Media Segments - by AustinL - 2025-04-02, 10:35 AM

    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    Home · Team · Help · Contact
    © Designed by D&D - Powered by MyBB
    L


    Jellyfin

    The Free Software Media System

    Linear Mode
    Threaded Mode