mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use .m4a extension not .mp4
The former is for audio the latter for video
This commit is contained in:
parent
08b10373a0
commit
8f20f7c259
@ -473,7 +473,7 @@ def embed_tts(container, report_progress=None, parent_widget=None):
|
|||||||
pos = 0
|
pos = 0
|
||||||
wav = io.BytesIO()
|
wav = io.BytesIO()
|
||||||
wav.write(wav_header_for_pcm_data(size_of_audio_data, HIGH_QUALITY_SAMPLE_RATE))
|
wav.write(wav_header_for_pcm_data(size_of_audio_data, HIGH_QUALITY_SAMPLE_RATE))
|
||||||
afitem = container.generate_item(name + '.mp4', id_prefix='tts-')
|
afitem = container.generate_item(name + '.m4a', id_prefix='tts-')
|
||||||
pfd.audio_file_name = container.href_to_name(afitem.get('href'), container.opf_name)
|
pfd.audio_file_name = container.href_to_name(afitem.get('href'), container.opf_name)
|
||||||
smilitem = container.generate_item(name + '.smil', id_prefix='smil-')
|
smilitem = container.generate_item(name + '.smil', id_prefix='smil-')
|
||||||
pfd.smil_file_name = container.href_to_name(smilitem.get('href'), container.opf_name)
|
pfd.smil_file_name = container.href_to_name(smilitem.get('href'), container.opf_name)
|
||||||
@ -496,8 +496,8 @@ def embed_tts(container, report_progress=None, parent_widget=None):
|
|||||||
wav.write(audio_data)
|
wav.write(audio_data)
|
||||||
make_par(container, seq, html_href, audio_href, s.elem_id, pos, duration)
|
make_par(container, seq, html_href, audio_href, s.elem_id, pos, duration)
|
||||||
wav.seek(0)
|
wav.seek(0)
|
||||||
with container.open(pfd.audio_file_name, 'wb') as mp4:
|
with container.open(pfd.audio_file_name, 'wb') as m4a:
|
||||||
transcode_single_audio_stream(wav, mp4)
|
transcode_single_audio_stream(wav, m4a)
|
||||||
container.pretty_print.add(pfd.smil_file_name)
|
container.pretty_print.add(pfd.smil_file_name)
|
||||||
container.dirty(pfd.smil_file_name)
|
container.dirty(pfd.smil_file_name)
|
||||||
container.serialize_item(pfd.smil_file_name)
|
container.serialize_item(pfd.smil_file_name)
|
||||||
|
@ -780,10 +780,10 @@ def develop_embedded():
|
|||||||
sz += len(data)
|
sz += len(data)
|
||||||
all_data[0] = wav_header_for_pcm_data(sz, HIGH_QUALITY_SAMPLE_RATE)
|
all_data[0] = wav_header_for_pcm_data(sz, HIGH_QUALITY_SAMPLE_RATE)
|
||||||
wav = ReadOnlyFileBuffer(b''.join(all_data), name='tts.wav')
|
wav = ReadOnlyFileBuffer(b''.join(all_data), name='tts.wav')
|
||||||
mp4 = io.BytesIO()
|
m4a = io.BytesIO()
|
||||||
mp4.name = 'tts.mp4'
|
m4a.name = 'tts.m4a'
|
||||||
transcode_single_audio_stream(wav, mp4)
|
transcode_single_audio_stream(wav, m4a)
|
||||||
subprocess.run(['mpv', '-'], input=mp4.getvalue())
|
subprocess.run(['mpv', '-'], input=m4a.getvalue())
|
||||||
|
|
||||||
|
|
||||||
def develop():
|
def develop():
|
||||||
|
@ -221,7 +221,7 @@ open_output_file(Transcoder *t) {
|
|||||||
if (!(t->ofmt_ctx->oformat = av_guess_format(t->container_format, t->output_filename, NULL))) {
|
if (!(t->ofmt_ctx->oformat = av_guess_format(t->container_format, t->output_filename, NULL))) {
|
||||||
if (t->container_format[0] || t->output_filename[0]) return set_error(t, PyExc_KeyError,
|
if (t->container_format[0] || t->output_filename[0]) return set_error(t, PyExc_KeyError,
|
||||||
"Could not determine container format for output filename: %s and container format name: %s", t->output_filename, t->container_format);
|
"Could not determine container format for output filename: %s and container format name: %s", t->output_filename, t->container_format);
|
||||||
if (!(t->ofmt_ctx->oformat = av_guess_format("mp4", "file.mp4", NULL))) return set_error(t, PyExc_Exception, "ffmpeg is missing support for the MP4 container format");
|
if (!(t->ofmt_ctx->oformat = av_guess_format("m4a", "file.m4a", NULL))) return set_error(t, PyExc_Exception, "ffmpeg is missing support for the m4a container format");
|
||||||
|
|
||||||
}
|
}
|
||||||
const AVCodec *output_codec = NULL;
|
const AVCodec *output_codec = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user