Skip to content

Commit

Permalink
add encoder to codec_name dict for use in streams_to_encode test of c…
Browse files Browse the repository at this point in the history
…odec_name
  • Loading branch information
yajrendrag committed Apr 21, 2024
1 parent 694cd2e commit 0a78415
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions source/asad_audio_encoder/changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

**<span style="color:#56adda">0.1.0</span>**
- add codec_name:encoder dictionary for use in streams_to_encode stream test
- add debug output in s2_encode

**<span style="color:#56adda">0.0.4</span>**
- fix erroneous reference to force_encoder

Expand Down
2 changes: 1 addition & 1 deletion source/asad_audio_encoder/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"on_worker_process": 0
},
"tags": "audio,encoder,ffmpeg,library file test",
"version": "0.0.4"
"version": "0.1.0"
}
12 changes: 11 additions & 1 deletion source/asad_audio_encoder/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@
"alac": "m4a",
}

#encoder / codec_name Dictionary
codec_name = {
"libfdk_aac": "aac",
"libmp3lame": "mp3",
"libopus": "opus",
"libvorbis": "vorbis",
"flac": "flac",
"alac": "alac",
}
class Settings(PluginSettings):
settings = {
"force_encoding": False,
Expand Down Expand Up @@ -162,8 +171,9 @@ def s2_encode(streams, probe_format, encoder, force_encoding, channel_rate, absp
return [0,0,0]

streams_to_encode = [(i, streams[i]["channels"], probe_format["bit_rate"]) for i in range(len(streams))
if ("codec_type" in streams[i] and streams[i]["codec_type"] == 'audio' and "codec_name" in streams[i] and streams[i]["codec_name"] != encoder and "bit_rate" in probe_format)
if ("codec_type" in streams[i] and streams[i]["codec_type"] == 'audio' and "codec_name" in streams[i] and streams[i]["codec_name"] != codec_name[encoder] and "bit_rate" in probe_format)
or (force_encoding == True and "codec_type" in streams[i] and streams[i]["codec_type"] == 'audio' and "bit_rate" in probe_format)]
logger.debug("streams_to_encode: '{}'".format(streams_to_encode))

if streams_to_encode != []:
return streams_to_encode
Expand Down

0 comments on commit 0a78415

Please sign in to comment.