pythonvideowebrtcaiortc

aiortc - Change video stream size


This is re-post of my question on Github, I'm trying to run the videostream-cli sample with differently sized videos.

Re-posting my question,

When using cli.py from the "videostream-cli" sample, I can't get the video stream to transmit/save at any resolution other than 640x480.

I see a few places in "aiortc/mediastreams.py" where this is hardcoded, but even changing them to my video sizes didn't seem to work.

I tried it with this video

wget 'http://downloads.4ksamples.com/videos/PUPPIES%20BATH%20IN%204K%20(ULTRA%20HD)(Original_H.264-AAC)%20(4ksamples.com).mp4' -O 'puppies.mp4'

(or wget 'http://mirrors.standaloneinstaller.com/video-sample/jellyfish-25-mbps-hd-hevc.mp4' -O jellyfish.mp4)

and then ran two peers using

videostream-cli/cli.py offer --play-from 'puppies.mp4' videostream-cli/cli.py answer --record-to 'received.mp4'

After some of the video is transmitted and written to disk, Ctrl+C those processes and try

ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 puppies.mp4

which should be 4096x2304 (or 1920x1080) and then run

ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 received.mp4

which always returns a 640x480 video

Help, am I missing something?


Solution

  • According to one of the maintainers, this is because PyAV (used in MediaRecorder) sets up a default size of 640x480 which aiortc doesn't change.

    See here for more information: https://github.com/aiortc/aiortc/issues/183