Videos: AVC file is unexpectedly transcoded, maybe due to a bitrate limit? #1487

Closed
opened 2026-02-20 00:13:32 -05:00 by deekerman · 2 comments
Owner

Originally created by @blue-kaleidoscope on GitHub (Jul 5, 2022).

1. What is not working as documented?

I have an MP4 file which comes from my Canon Powershot G7X Mark II which uses the h264 codec.
Using Photoprism v220629 starts the encoding process with libx264 once the video should get played back.
Using photoprism v220617 plays back the video directly without encoding it beforehand (as expected).

2. How can we reproduce it?

Steps to reproduce the behavior:

Simply try to play back the attached file with Photoprism: https://www.dropbox.com/s/41i2dqxbwn8xbcx/MVI_0658.MP4?dl=0

6. Which software versions do you use?

(a) PhotoPrism Architecture & Build Number: AMD64 220629-bookworm

(b) Database Type & Version: MariaDB 10.7

(c) Operating System Types & Versions: Hosted on Linux, Clients are iOS 15.5 and Windows 10

(d) Browser Types & Versions: Safari (iPhone) and Brave (iPhone v1.39.1, Windows 10 Version 1.40.109 Chromium: 103.0.5060.66)

ffmpeg output of the file:

 Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 1920x1080, 24532 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)

Docker log excerpt:

photoprism    | time="2022-07-05T20:39:27Z" level=info msg="libx264: transcoding 2022/07/20220705_221848_5D09DA79.mp4 to avc"
photoprism    | time="2022-07-05T20:39:49Z" level=info msg="libx264: created 20220705_221848_5D09DA79.mp4.avc [22.313096892s]"
Originally created by @blue-kaleidoscope on GitHub (Jul 5, 2022). #### 1. What is not working as documented? I have an MP4 file which comes from my Canon Powershot G7X Mark II which uses the h264 codec. Using Photoprism **v220629** starts the encoding process with libx264 once the video should get played back. Using photoprism **v220617** plays back the video directly without encoding it beforehand (as expected). #### 2. How can we reproduce it? Steps to reproduce the behavior: Simply try to play back the attached file with Photoprism: https://www.dropbox.com/s/41i2dqxbwn8xbcx/MVI_0658.MP4?dl=0 #### 6. Which software versions do you use? (a) PhotoPrism Architecture & Build Number: AMD64 220629-bookworm (b) Database Type & Version: MariaDB 10.7 (c) Operating System Types & Versions: Hosted on Linux, Clients are iOS 15.5 and Windows 10 (d) Browser Types & Versions: Safari (iPhone) and Brave (iPhone v1.39.1, Windows 10 Version 1.40.109 Chromium: 103.0.5060.66) ffmpeg output of the file: ``` Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 1920x1080, 24532 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default) ``` Docker log excerpt: ``` photoprism | time="2022-07-05T20:39:27Z" level=info msg="libx264: transcoding 2022/07/20220705_221848_5D09DA79.mp4 to avc" photoprism | time="2022-07-05T20:39:49Z" level=info msg="libx264: created 20220705_221848_5D09DA79.mp4.avc [22.313096892s]" ```
deekerman 2026-02-20 00:13:32 -05:00
Author
Owner

@lastzero commented on GitHub (Jul 5, 2022):

I suspect that the average bitrate is above the configured limit, so the API transcodes the video as intended. For details, see:

@lastzero commented on GitHub (Jul 5, 2022): I suspect that the average bitrate is above the configured limit, so the API transcodes the video as intended. For details, see: - #2461
Author
Owner

@blue-kaleidoscope commented on GitHub (Jul 6, 2022):

Understood. It totally makes sense. I was just confused because my environment variable was set to PHOTOPRISM_FFMPEG_BITRATE: "25" and ffmpeg gave me for this file Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 1920x1080, 24532 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default). I assumed 24532 kb/s is less than 25 MBit/s.

But I figured out that you take the file size in Bit and divide it by the length of the video which gives roughly 28.4 MBit/s.

Sorry for assuming it's a bug so quickly. :-/

@blue-kaleidoscope commented on GitHub (Jul 6, 2022): Understood. It totally makes sense. I was just confused because my environment variable was set to `PHOTOPRISM_FFMPEG_BITRATE: "25"` and ffmpeg gave me for this file `Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 1920x1080, 24532 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)`. I assumed 24532 kb/s is less than 25 MBit/s. But I figured out that you take the file size in Bit and divide it by the length of the video which gives roughly 28.4 MBit/s. Sorry for assuming it's a bug so quickly. :-/
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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
starred/photoprism#1487
No description provided.