Audio missing in rendered Video file using pip bpy module 3.5 #109524

Closed
opened 2023-06-29 18:53:27 +02:00 by alok · 7 comments

System Information
Operating system: macOS Ventura13.1
Graphics card: Intel Iris Plus Graphics 645 1536 MB
Memory: 8 GB 2133 MHz LPDDR3

Blender Version
Used bpy 3.5 package published in PyPI
link: https://pypi.org/project/bpy/3.5.0/

Short description of error

The same blend file is giving correct output with audio if rendered using Blender 3.5.0 application locally but when I am trying it with the bpy 3.5 package audio is missing. Looked for doc/solutions but had no success. The post-processing tab's compositing and sequencer both are ticked in the blend file which I crossed checked as per most available answers.

STEPS

  1. take a video blend file.
  2. pip install bpy
  3. I was trying to update the text value in the video that is not required for the issue so writing down only related code.
import bpy

bpy.ops.wm.open_mainfile(filepath=blend_file_path)
bpy.context.scene.render.filepath = location.mp4
bpy.data.scenes["Scene"].render.image_settings.file_format = 'FFMPEG'
bpy.ops.render.render(animation=animation, write_still=True)
  1. Attached output files details as well. As we can see one file has no audio channel and codecs are also missing MPEG-4 AAC

Please help me out as I am stuck in this for longer and it's a bit important.
Thanks and regards
Alok

**System Information** Operating system: macOS Ventura13.1 Graphics card: Intel Iris Plus Graphics 645 1536 MB Memory: 8 GB 2133 MHz LPDDR3 **Blender Version** Used bpy 3.5 package published in PyPI link: https://pypi.org/project/bpy/3.5.0/ **Short description of error** The same blend file is giving correct output with audio if rendered using Blender 3.5.0 application locally but when I am trying it with the bpy 3.5 package audio is missing. Looked for doc/solutions but had no success. The post-processing tab's compositing and sequencer both are ticked in the blend file which I crossed checked as per most available answers. **STEPS** 1. take a video blend file. 2. pip install bpy 3. I was trying to update the text value in the video that is not required for the issue so writing down only related code. ```Py import bpy bpy.ops.wm.open_mainfile(filepath=blend_file_path) bpy.context.scene.render.filepath = location.mp4 bpy.data.scenes["Scene"].render.image_settings.file_format = 'FFMPEG' bpy.ops.render.render(animation=animation, write_still=True) ``` 4. Attached output files details as well. As we can see one file has no audio channel and codecs are also missing MPEG-4 AAC Please help me out as I am stuck in this for longer and it's a bit important. Thanks and regards Alok
alok added the
Type
Report
Status
Needs Triage
Priority
Normal
labels 2023-06-29 18:53:28 +02:00
Member

Could you give us the file that replicates the issue?

Default Output > Encoding > Audio is No Audio, you probably want to manually set that in your script as well. But since you said if rendered in blender it's okay, it looks kinda suspicious.

Could you also try calling blender executable with the script by using blender -b --python <filename> and see if audio works? If it works then it could be possibly the problem of the pip package.

Could you give us the file that replicates the issue? Default `Output > Encoding > Audio` is `No Audio`, you probably want to manually set that in your script as well. But since you said if rendered in blender it's okay, it looks kinda suspicious. Could you also try calling blender executable with the script by using `blender -b --python <filename>` and see if audio works? If it works then it could be possibly the problem of the pip package.
Author

Hi @ChengduLittleA ,

Thanks for your quick response. I tried the file using blender -b --python <filename> command as suggested and it's giving proper output [Audio is available].

Attaching the Zip which includes all related files [video, blend, and font]

Note: this video is a publicly available resource and we don't have any relationship with this.

Hi @ChengduLittleA , Thanks for your quick response. I tried the file using `blender -b --python <filename>` command as suggested and it's giving proper output [Audio is available]. Attaching the Zip which includes all related files [video, blend, and font] Note: this video is a publicly available resource and we don't have any relationship with this.
Member

Hi @alokkrchoudhary , this probably means the packaged pip bpy module is somewhat broken. Will notify developers on this.

Notice that the bpy module required python version must match the python version you are running it from.

Hi @alokkrchoudhary , this probably means the packaged pip bpy module is somewhat broken. Will notify developers on this. Notice that the bpy module required python version must match the python version you are running it from.
YimingWu added
Status
Needs Info from Developers
and removed
Status
Needs Information from User
labels 2023-06-30 09:22:52 +02:00
YimingWu changed title from Audio missing in rendered Video file using bpy 3.5 to Audio missing in rendered Video file using pip bpy module 3.5 2023-06-30 09:24:05 +02:00
Author

Thanks again @ChengduLittleA .

Yes, we are using the same Python version as asked in PyPI [ python:3.10 ]. Please keep me updated with the package fix or any further details required from me.

Thanks again @ChengduLittleA . Yes, we are using the same Python version as asked in PyPI [ python:3.10 ]. Please keep me updated with the package fix or any further details required from me.
Author

Hey @ChengduLittleA ,

I tried with the new bpy published yesterday [bpy==3.6.0]. The same issue is in that package as well.

Could you please update me on the progress of this issue?

Thanks
Alok

Hey @ChengduLittleA , I tried with the new bpy published yesterday [bpy==3.6.0]. The same issue is in that package as well. Could you please update me on the progress of this issue? Thanks Alok

The bpy module does not compile-in audio support since its beginning. Relevant code in the configuration.

Within the current state of the audio support if the bpy is compiled with audi osupport loading it will be considerably slower, and it could interfere with other applications.

There is some work-in-progress to initialize audio on-demand, for example #107607. Similar thing would need to be done for all audio backends. After that is done I think we could enable audio support in bpy.

The bpy module does not compile-in audio support since its beginning. [Relevant code](https://projects.blender.org/blender/blender/src/branch/main/build_files/cmake/config/bpy_module.cmake#L62) in the configuration. Within the current state of the audio support if the bpy is compiled with audi osupport loading it will be considerably slower, and it could interfere with other applications. There is some work-in-progress to initialize audio on-demand, for example #107607. Similar thing would need to be done for all audio backends. After that is done I think we could enable audio support in bpy.
Member

I guess we could close this as a known issue.

I guess we could close this as a known issue.
Blender Bot added
Status
Archived
and removed
Status
Needs Info from Developers
labels 2023-07-05 11:41:16 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#109524
No description provided.