diff --git a/src/calibre/ebooks/oeb/polish/tts.py b/src/calibre/ebooks/oeb/polish/tts.py index 3fa922c202..f3f32d4256 100644 --- a/src/calibre/ebooks/oeb/polish/tts.py +++ b/src/calibre/ebooks/oeb/polish/tts.py @@ -473,7 +473,7 @@ def embed_tts(container, report_progress=None, parent_widget=None): pos = 0 wav = io.BytesIO() 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) smilitem = container.generate_item(name + '.smil', id_prefix='smil-') 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) make_par(container, seq, html_href, audio_href, s.elem_id, pos, duration) wav.seek(0) - with container.open(pfd.audio_file_name, 'wb') as mp4: - transcode_single_audio_stream(wav, mp4) + with container.open(pfd.audio_file_name, 'wb') as m4a: + transcode_single_audio_stream(wav, m4a) container.pretty_print.add(pfd.smil_file_name) container.dirty(pfd.smil_file_name) container.serialize_item(pfd.smil_file_name) diff --git a/src/calibre/gui2/tts/piper.py b/src/calibre/gui2/tts/piper.py index b9a1e64b2d..8279897eab 100644 --- a/src/calibre/gui2/tts/piper.py +++ b/src/calibre/gui2/tts/piper.py @@ -780,10 +780,10 @@ def develop_embedded(): sz += len(data) all_data[0] = wav_header_for_pcm_data(sz, HIGH_QUALITY_SAMPLE_RATE) wav = ReadOnlyFileBuffer(b''.join(all_data), name='tts.wav') - mp4 = io.BytesIO() - mp4.name = 'tts.mp4' - transcode_single_audio_stream(wav, mp4) - subprocess.run(['mpv', '-'], input=mp4.getvalue()) + m4a = io.BytesIO() + m4a.name = 'tts.m4a' + transcode_single_audio_stream(wav, m4a) + subprocess.run(['mpv', '-'], input=m4a.getvalue()) def develop(): diff --git a/src/calibre/utils/ffmpeg.c b/src/calibre/utils/ffmpeg.c index 286f85fc67..dd1b73dbff 100644 --- a/src/calibre/utils/ffmpeg.c +++ b/src/calibre/utils/ffmpeg.c @@ -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->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); - 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;