Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • P PyAV
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 37
    • Issues 37
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 26
    • Merge requests 26
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PyAV
  • PyAV
  • Issues
  • #1096
Closed
Open
Issue created Mar 03, 2023 by zhichaoGuo@zhichaoGuo0 of 1 checklist item completed0/1 checklist item

how to push a .264 file to the rtp url?

Overview

I want to open the local file and push the stream to rtp, but I haven't found a suitable example. I wrote a simple script, but it did not run well. I think the option is not set correctly. How should I modify it? in ffmpeg cmd it just like "ffmpeg -re -i .\bin\big.264 -vcodec copy -an -t 100 -f rtp rtp://127.0.0.1:12150"

    import av
    path_to_video = ".\\bin\\big.264"
    with av.open(path_to_video) as input_:
        with av.open("rtp://127.0.0.1:12150", "w", format="rtp") as output:
            stream = output.add_stream('libx264', rate=23, options={"crf": "23"})
            stream.width = input_.streams.video[0].codec_context.width
            stream.height = input_.streams.video[0].codec_context.height
            stream.pix_fmt = input_.streams.video[0].codec_context.pix_fmt
            print(type(output))
            for frame in input_.decode(video=0):
                output.mux(stream.encode(frame))
        output.close()
    input_.close()

Expected behavior

RTP receives video packets at normal rate

Actual behavior

rtp terminal plays thevery fast, and the second time he runs the script, he will report the following error.

Traceback:

non-existing SPS 0 referenced in buffering period
non-existing SPS 0 referenced in buffering period
non-strictly-monotonic PTS
non-strictly-monotonic PTS
 (repeated 1438 more times)

Investigation

  • query the pyav docs (But that doesn't any help)
  • checked all relevant issues (but it seems that no one has tried to do it)
  • query help in Google
  • ask in gitter but no one can help me

Research

I have done the following:

  • [ √ ] Checked the PyAV documentation
  • [ √ ] Searched on Google
  • [ √ ] Searched on Stack Overflow
  • [ √ ] Looked through old GitHub issues
  • [ √ ] Asked on PyAV Gitter
  • ... and waited 72 hours for a response.

Additional context

Assignee
Assign to
Time tracking