Skip to content

Commit 46fa351

Browse files
committed
Fix video resolution in mp4 file avc1 box
The PyAv output container is a kind of copy of the dummy one we use to fish out the encoder data. But we must set the correct output resolution too. Signed-off-by: David Plowman <[email protected]>
1 parent 2082fe6 commit 46fa351

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

picamera2/encoders/h264_encoder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def _start(self):
8686

8787
# The output objects may need to know what kind of stream this is.
8888
for out in self._output:
89-
out._add_stream("video", "h264")
89+
out._add_stream("video", "h264", width=self._width, height=self._height)
9090

9191
super()._start()
9292

picamera2/encoders/libav_h264_encoder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def _start(self):
7878
self._stream.pix_fmt = "yuv420p"
7979

8080
for out in self._output:
81-
out._add_stream(self._stream, self._codec, rate=self.framerate)
81+
out._add_stream(self._stream, self._codec, rate=self.framerate, width=self.width, height=self.height)
8282

8383
preset = "ultrafast"
8484
if self.profile is not None:

picamera2/encoders/mjpeg_encoder.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def _setup(self, quality):
3838
def _start(self):
3939
# The output objects may need to know what kind of stream this is.
4040
for out in self._output:
41-
out._add_stream("video", "mjpeg", rate=30) # seem to need a rate to prevent timestamp warnings
41+
# Seem to need a rate to prevent timestamp warnings.
42+
out._add_stream("video", "mjpeg", rate=30, width=self.width, height=self.height)
4243

4344
super()._start()

0 commit comments

Comments
 (0)