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
  • #992
Closed
Open
Issue created Jun 12, 2022 by Administrator@rootContributor0 of 1 checklist item completed0/1 checklist item

How do I decode g729

Created by: user3472g

IMPORTANT: Be sure to replace all template sections {{ like this }} or your issue may be discarded.

Overview

I am attempting to write a simple g729 decoder using PyAV. However, the audio being outputted is of extremely poor audio quality and does not match that of CLI ffmpeg.

Expected behavior

Output an audible audio file from g729 input.

Actual behavior

audio being outputted is of extremely poor audio quality and does not match that of CLI ffmpeg. I am unable to attach a sample g729 file here to this ticket. The request here is to review the provided sample code for sensibleness.

Traceback:

No exceptions.

Investigation

Sample code:

    with open(path_to_g729_encoded_file, "rb") as f:  
      buf = f.read()  
      codec = av.CodecContext.create("g729", 'r')  
      codec.channels = 1  
      codec.bit_rate = 8000  
      codec.sample_rate = 8000  
      g729Packets = codec.parse(buf)  
      fout = open("audio.s16p", "wb")  
      for g729 in g729Packets: 
         for frame in codec.decode(g729):  
            for plane in frame.planes:  
              fout.write(bytes(plane))  
      fout.close()

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.
Assignee
Assign to
Time tracking