-
Notifications
You must be signed in to change notification settings - Fork 43
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
Check audio codec on uploaded videos #1414
base: dev
Are you sure you want to change the base?
Conversation
Your Testserver will be ready at https://1414.test.live.mm.rbg.tum.de in a few minutes. Logins
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!! I added a couple ideas on your code :)
probe, err := probe(file) | ||
if err != nil { | ||
return "", err | ||
} | ||
return gjson.Get(probe, "streams.0.codec_name").String(), nil | ||
codecNumber := gjson.Get(probe, "streams.#").Int() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a more descriptive name would be nice, something like
codecNumber := gjson.Get(probe, "streams.#").Int() | |
nStreams := gjson.Get(probe, "streams.#").Int() |
videoIndex = int(gjson.Get(probe, fmt.Sprintf("streams.%d.index", i)).Int()) | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead we could just return here
videoIndex = int(gjson.Get(probe, fmt.Sprintf("streams.%d.index", i)).Int()) | |
break | |
return gjson.Get(probe, fmt.Sprintf("streams.%d.codec_name", i)).String(), nil |
return "", errors.New("no video stream found") | ||
} | ||
|
||
func getAudioCodec(file string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we could combine these methods into one, something like this:
func getAudioCodec(file string) (string, error) { | |
// getCodec returns the codec of the file, codecType=video returns the video codec, codecType=audio the audio codec. | |
func getCodec(file string, codecType string) (string, error) { |
Motivation and Context
https://github.com/TUM-Dev/gocast/issues/1336
Description
Audio codec is now also checked during filavigate to a Livestreame upload and if it is not in aac format it will be transcoded.
Steps for Testing
Screenshots