Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFmpeg: Allow selection of specific video and audio streams for transcoding #3284

Closed
lastzero opened this issue Mar 14, 2023 · 9 comments
Closed
Assignees
Labels
enhancement Refactoring, improvement or maintenance task released Available in the stable release video Video Formats, Transcoding, FFmpeg, Streaming & Co

Comments

@lastzero
Copy link
Member

lastzero commented Mar 14, 2023

As a user with videos that contain additional video or audio streams, I want to select which streams to transcode so that the others are ignored and do not cause problems during transcoding.

Updated FFmpeg Config Options

Environment CLI Flag Default Description
PHOTOPRISM_FFMPEG_BIN --ffmpeg-bin ffmpeg FFmpeg COMMAND for video transcoding and thumbnail extraction
PHOTOPRISM_FFMPEG_ENCODER --ffmpeg-encoder libx264 FFmpeg AVC encoder NAMEsponsors only
PHOTOPRISM_FFMPEG_BITRATE --ffmpeg-bitrate 50 maximum FFmpeg encoding BITRATE (Mbit/s)
PHOTOPRISM_FFMPEG_MAP_VIDEO --ffmpeg-map-video 0:v:0 video STREAMS that should be transcoded
PHOTOPRISM_FFMPEG_MAP_AUDIO --ffmpeg-map-audio 0:a:0? audio STREAMS that should be transcoded

Original Feature Request

When I upgraded my phone to the Google Pixel 7, I noticed that the videos it takes have an extra video stream in them for their compressed HVC1 implementation. This means that all software transcoding of that format would result in an unplayable video file, as it was transcoding the wrong video stream (likely a second stream of parity or difference data). This alteration fixed the issue for me, and will likely avoid video files with multiple video streams causing issues in the future.
MEDumont

FFmpeg Documentation

Related Pull Requests

@lastzero lastzero added enhancement Refactoring, improvement or maintenance task video Video Formats, Transcoding, FFmpeg, Streaming & Co labels Mar 14, 2023
@lastzero lastzero self-assigned this Mar 14, 2023
@lastzero lastzero changed the title FFmpeg: Allow video and audio streams to be mapped when transcoding FFmpeg: Allow selection of specific video and audio streams for transcoding Mar 14, 2023
@lastzero
Copy link
Member Author

@ghostwheel We would appreciate it very much if you could help us test this change we added for you!

lastzero added a commit that referenced this issue Mar 14, 2023
Signed-off-by: Michael Mayer <michael@photoprism.app>
@lastzero lastzero added the please-test Ready for acceptance test label Mar 14, 2023
@lastzero lastzero added the help wanted Well suited for external contributors! label Mar 14, 2023
@ghostwheel
Copy link
Contributor

I'd think that this parameter would need to be per video, or per camera, since if someone has a device that produces the important streams not as first, they still might have other videos for which the relevant stream is 0....

lastzero added a commit that referenced this issue Mar 14, 2023
Signed-off-by: Michael Mayer <michael@photoprism.app>
@lastzero
Copy link
Member Author

Per video? How should that work?

@lastzero
Copy link
Member Author

Is it best to remove all of this again? :D

@ghostwheel
Copy link
Contributor

I'm not sure. You would have to be able to chose which stream to play when there are several... a hack could be that it would be in the notes of the video. But I wouldn't totally remove it, since it makes things totally not work for some users....
I guess a middle ground would be only use map parameter when several streams exist?

@lastzero
Copy link
Member Author

That would require to extract and index that information, which we current do not. It's another day of work at a minimum and we should be stable now as everyone is waiting for the next release. Might not be the right moment to change that much, that quickly?

@ghostwheel
Copy link
Contributor

So I think the way you have it would be good.

@lastzero
Copy link
Member Author

Alright, I'll keep it that way for now until someone complains or has a better idea we can implement within the time available 👍

@ghostwheel
Copy link
Contributor

Another option would be to totally export all the handling to a separate part that calls ffmpeg, and then users can more easily configure it to their heart's content with being dependent on various attributes of the video. Also not something to do quickly.

seeschloss pushed a commit to seeschloss/photoprism that referenced this issue Apr 10, 2023
…m#3284

Signed-off-by: Michael Mayer <michael@photoprism.app>
seeschloss pushed a commit to seeschloss/photoprism that referenced this issue Apr 10, 2023
Signed-off-by: Michael Mayer <michael@photoprism.app>
@graciousgrey graciousgrey added released Available in the stable release and removed help wanted Well suited for external contributors! please-test Ready for acceptance test labels May 3, 2023
@lastzero lastzero moved this to Released 🌈 in Roadmap 🚀✨ Jun 8, 2023
lastzero added a commit that referenced this issue May 13, 2024


Signed-off-by: Michael Mayer <michael@photoprism.app>
lastzero added a commit that referenced this issue May 13, 2024


Signed-off-by: Michael Mayer <michael@photoprism.app>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Refactoring, improvement or maintenance task released Available in the stable release video Video Formats, Transcoding, FFmpeg, Streaming & Co
Projects
Status: Release 🌈
Development

No branches or pull requests

3 participants