Questions tagged [pyav]

Questions about PyAV. A Python binding for the FFmpeg libraries. PyAV is intended to access to your media via containers, streams, packets, codecs, and frames. It proposes a few transformations of that data, and helps you get your data to/from other packages (e.g. Numpy and Pillow) all of this with a high level of abstraction.

Questions about PyAV. A Python binding for the FFmpeg libraries. PyAV is intended to access to your media via containers, streams, packets, codecs, and frames. It proposes a few transformations of that data, and helps you get your data to/from other packages (e.g. Numpy and Pillow) all of this with a high level of abstraction.

Read more about the package here

50 questions
5
votes
1 answer

Reading a video directly into Numpy with PyAV (no iterations)

Is it possible to read a video directly into a 3D Numpy with PyAV? Currently, I am looping through each frame: i = 0 container = av.open('myvideo.avi') for frame in container.decode(video=0): if i == 0: V =…
AaronJPung
  • 1,105
  • 1
  • 19
  • 35
5
votes
0 answers

PyAV: force new framerate while remuxing stream?

I have a Python program that receives a sequence of H264 video frames over the network, which I want to display and, optionally, record. The camera records at 30FPS and sends frames as fast as it can, which isn't consistently 30FPS due to changing…
ToxicFrog
  • 2,554
  • 18
  • 18
5
votes
3 answers

Number of frames in a video using PyAV

I use the library PyAV because it's one of the fatest available with Python. Here is a simple example of code I would like to use: import av video = av.open("My_Super_Video.mp4") total_frames = # ???? for i, frame in…
Jonathan DEKHTIAR
  • 3,456
  • 1
  • 21
  • 42
4
votes
2 answers

How to use pyav or opencv to decode a live stream of raw H.264 data?

The data was received by socket ,with no more shell , they are pure I P B frames begin with NAL Header(something like 00 00 00 01). I am now using pyav to decode the frames ,but i can only decode the data after the second pps info(in key frame) was…
Dery
  • 177
  • 1
  • 11
4
votes
1 answer

Can get timestamp of frame in video with pyav - python

How can I get timestamp of a frame in a video or rtmp stream from pts and time_base or duration? Thanks a lot! import av def init_input(file_name): global a container = av.open(file_name) a = container.duration return…
Thanh Nguyen
  • 41
  • 1
  • 2
3
votes
0 answers

PyAV/ffmpeg: How to resolve 'Reinit context to WxH ... deprecated pixel format'

I am using the pyav library to read and process video data and as I am reading through the videos I am getting lots (and lots) of the following output. I am creating the videos by segmenting either a much larger source file or RTSP/HTTP IP camera. I…
hi im Bacon
  • 374
  • 1
  • 12
3
votes
0 answers

Decode video frames from growing BytesIO

So we have: Incoming video segments of one second duration Segments are parts of a continuous video Each segment is an array of bytes Only the first segment has the necessary meta information to decode the entire video I want to replenish the byte…
Bergutov Ruslan
  • 157
  • 2
  • 14
3
votes
1 answer

Python av play file in infinite loop

Using https://pypi.org/project/av/ trying to open file for infinite playback. But the cycle ends with the last frame. After searching and reading manuals, test code looks as follows: (Note: these options are expected to be passed down to…
yan
  • 196
  • 1
  • 9
3
votes
0 answers

Using PyAV to generate audio broadcast server (UDP socket)

I have to create a service which captures the audio from the PC microphone and to broadcast it as UDP packets. I am on a Debian platform and I have to use Python (3.7). I would like to use PyAV because I have to link this broadcasting system to a…
RiccardoB
  • 141
  • 15
2
votes
1 answer

Creating video from images using PyAV

I am trying to write a function that creates a new MP4 video from a set of frames taken from another video. The frames will be given in PIL.Image format and is often cropped to include only a part of the input video, but all images will have the…
ATK
  • 47
  • 1
  • 8
2
votes
1 answer

ERROR: Could not build wheels for av, which is required to install pyproject.toml-based projects

I have been trying to install AV (https://github.com/PyAV-Org/PyAV#installation) using both: pip install av and pip install av --no-binary av with no luck. Previously I installed all the system packages as recommended here…
Mike B
  • 2,136
  • 2
  • 12
  • 31
2
votes
1 answer

How to convert in-memory WebM audio file to mp3 audio file in Python?

I am trying to convert the audio file in WebM format into MP3 file. I need to keep both files in memory due to server limitations. I tried to do it using PyAv, but I can't manage to receive Python file-like object after processing stream. My…
Denys Ivanenko
  • 388
  • 7
  • 21
2
votes
1 answer

generate video with PyAv (from image generator and audio file)

There is a logic based on the python generator that uses PyAv to create a fixed sound file and an image equal to the length or 1 frame longer. However, I want to perform this process at once, and I want to implement it without calling ffmpeg…
tsp
  • 61
  • 7
2
votes
1 answer

PyAV inconsistency when parsing packets from h264 frames

When producing H.264 frames and decoding them using pyAV, packets are parsed from frames only when invoking the parse methods twice. Consider the following test H.264 input, created using: ffmpeg -f lavfi -i testsrc=duration=10:size=1280x720:rate=30…
Shlomi Uziel
  • 868
  • 7
  • 15
2
votes
2 answers

Python process TypeError: no default __reduce__ due to non-trivial __cinit__

from aiohttp import web from aiortc.mediastreams import MediaStreamTrack from aiortc import RTCPeerConnection, RTCSessionDescription from aiortc.contrib.media import MediaPlayer from pydub import AudioSegment import av from aiohttp import web from…
Chris P
  • 2,059
  • 4
  • 34
  • 68
1
2 3 4