Audio Backend#6824
Conversation
…ket. Will utilize for discussion and agreement on MVP
Gykes
left a comment
There was a problem hiding this comment.
I want to preface this by saying I'm not the main dev and, quite frankly, have limited experience with design implementation so take what I say with a grain of salt. If something sounds dumb or wrong it probably is and feel free to call me on it.
| - duration | ||
| - audio codec | ||
| - OPTIONAL (can be added now or later) | ||
| - channels (mono, stereo, 5.1, 7.1) |
There was a problem hiding this comment.
Would tthis really be needed? Currently scenes have audio and we don't track this at all.
There was a problem hiding this comment.
I would suggest looking at bitrate again, as this is tracked for scenes (the video portion).
And it might be better to add now, instead of planning to add later.
There was a problem hiding this comment.
Mostly I was referring to the channels. I think bitrate would be fine.
| `created_at` datetime not null, | ||
| `updated_at` datetime not null, | ||
| `code` text, | ||
| `artists` text, |
There was a problem hiding this comment.
If we decide to go with performers this would need to be changed.
| `updated_at` datetime not null, | ||
| `code` text, | ||
| `artists` text, | ||
| `album` text, |
There was a problem hiding this comment.
Studio was in the Audio Metadata but album is used here. How and where would we store albums? In the case of audio, studios seem like the best fit.
| `title` varchar(255), | ||
| `details` text, | ||
| `date` date, | ||
| `rating` tinyint, |
There was a problem hiding this comment.
Probs better to use rating100 similar to scenes.
There was a problem hiding this comment.
the migrations for scenes uses rating (ref: pkg/sqlite/migrations/1_initial.up.sql). I can only find rating100 in the graphql, which I do provide in graphql/schema/types/audio.graphql (line 51)
| foreign key(`audio_id`) references `audios`(`id`) on delete cascade, | ||
| PRIMARY KEY("group_id", `audio_id`) | ||
| ); | ||
| CREATE INDEX `index_movies_audios_on_movie_id` on "groups_audios" ("group_id"); |
There was a problem hiding this comment.
renamed to index_group_audios_on_group_id
|
tbh there is no reason why audios should not just be scenes and why there would be a dedicated section for them. |
Lots of errors to fix and TODO notes
- Removed funscripts, they are for interactive - updated the scanner to correctly create `audio_files` row - Adding Audio to `paths` - Updated sqlite to add AudioFile Need to update mutations next
- removed todos - tested mutations - updated the autotagger - added missing sort options - open question generated from this
|
@Gykes I can see nothing else required for this PR. In your court. Please see my TODO notes that require your input |
|
Will give it a gander tomorrow probably. I don't have the brain power right now to look over a 13k addition lol |
Any luck, haven't seen any PR comments yet |
I have various thoughts lined up. Been thinking on stuff the last few days passively. I will start putting my thoughts in now so you can think on it as well. |
Gykes
left a comment
There was a problem hiding this comment.
These are just initial thoughts that I remembered off the top of my head. Adding testing would probably be a good idea. Review process will be slow on this. Sorry but prepping to move cross country and time is becoming more and more limited.
I went over some of your TODO questions in the review. Also I think, if we are doing transcoding in a separate PR, then we should probably rip out the commented trans coding support sections. Currently all it is doing is increasing LOC count.
| -- | ||
|
|
||
| -- TODO(audio): think of better name for this, too close to `audios_files` | ||
| CREATE TABLE `audio_files` ( |
There was a problem hiding this comment.
audio_file_info? Not married to this was just the first thing that popped into my head. Happy to hear recs.
There was a problem hiding this comment.
files_audio(would need to migratevideo_files->files_videoto match naming convention)audio_only_filesaudiofiles(not a fan)
| if instance.Config.IsCreateImageClipsFromVideos() && stash != nil && stash.ExcludeVideo { | ||
| // TODO(audio): figure out this IF condition | ||
| return isImage(pathname) || isVideo(pathname) | ||
| } |
There was a problem hiding this comment.
Does this even need to exist?
There was a problem hiding this comment.
I am confused by this as well and would value input here
| var ( | ||
| directAudioEndpointType = endpointType{ | ||
| label: "Direct stream", | ||
| mimeType: ffmpeg.MimeMp3Audio, |
There was a problem hiding this comment.
If we hardcode this for all direct streams wont that also serve all other formats? Flac,m4a, etc. This could break audio playback. We could resolve this at the container instead
There was a problem hiding this comment.
This is copied from internal/manager/scene.go, I don't see any benefit making audio different from scenes unless it requires it to meet feature-set.
Copied to make it easier to compare:
directEndpointType = endpointType{
label: "Direct stream",
mimeType: ffmpeg.MimeMp4Video,
extension: "",
}| endpoints = append(endpoints, makeStreamEndpoint(directAudioEndpointType)) | ||
| } | ||
|
|
||
| // TODO(audio): can we return no urls? |
There was a problem hiding this comment.
Seems like the scheme declares a non null array. You would need to return it as an empty slice. Something like []*AudioStreamEndpoint{}
| title: String | ||
| code: String | ||
| details: String | ||
| url: String @deprecated(reason: "Use urls") |
There was a problem hiding this comment.
Could probably remove this from the audio side. It was never implemented on here so don't see the need for it to be deprecated but there's not issue with having it, just extra LOC.
EDIT: This could apply to the other deprecated fields as well
| @@ -0,0 +1,39 @@ | |||
| // TODO(audio): should this file be deleted since there are no transcodes? | |||
There was a problem hiding this comment.
If we are doing transcodes at a later date then yea, should probably remove this to keep scope and LOC down.
There was a problem hiding this comment.
File should continue existing, it is used to find duplicate files with the same hash and merge them into the same audio
| func (a *AudioFile) getStreamIndex(fileType string, probeJSON FFProbeJSON) int { | ||
| ret := -1 | ||
| for i, stream := range probeJSON.Streams { | ||
| // skip cover art/thumbnails | ||
| if stream.CodecType == fileType && stream.Disposition.AttachedPic == 0 { | ||
| // prefer default stream | ||
| if stream.Disposition.Default == 1 { | ||
| return i | ||
| } | ||
|
|
||
| // backwards compatible behaviour - fallback to first matching stream | ||
| if ret == -1 { | ||
| ret = i | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
This is a copy of the video version at roughly line 284. Could break this out to a helper to reduce LOC changes.
There was a problem hiding this comment.
I can do this, but I think that might make things more confusing. Since this is a tradition copy-paste+rename PR, making new changes would require more thinking than just accepting that what works for Scenes will work for Audio.
Perhaps we can defer this change to when the feature is more accepted and new audio specific features are added (transcodes/waveform sprites/ui/etc)?
|
I see you making review comments. I am currently beginning my move and wont be setup back up fully till around the 16th. I still have my laptop and MAY get to them if I'm bored or have time to kill during transit. I haven't forgotten but just ping me after the 15th if you think I have |
This is a copy-paste setup for the backend to support AUDIO, similar to how Scene's and Images are handled.
Please see the
docs/dev/AUDIO.mdfor the SCOPE and as a place for general discussion.There is no new design, it copies form SCENES and then removes what is unrelated
Exception:
FrameRatehas been changed toSampleRate(FFPROBE already grabs this)Relates to: #1258
TODOs that require Reviewer input