Overview
I had an opportunity to convert audio published on the National Diet Library Historical Sound Archive (hereinafter “Rekion”) to mp4, so here are my notes.
Format Provided by Rekion
Rekion provides files in m3u8 format.
For example, let’s check the following: “Lecture: Union of Morality and Economy (Part 1).”
https://rekion.dl.ndl.go.jp/pid/3574643
By checking with developer tools, you can confirm that it is accessible from the following URL.
The IDs that make up this URL can be found in the response from the following API.
https://rekion.dl.ndl.go.jp/api/item/search/info:ndljp/pid/3574643
Developing an API to Retrieve the Above URL from a PID
By processing the above JSON, the URL of the m3u8 file can be obtained.
I created an API for this part, so please try it out.
https://iiif-demo-next.vercel.app/api/rekion/3574643
The following result is obtained.
The source code is available here.
https://github.com/nakamura196/iiif-demo-next/blob/main/src/app/api/rekion/[id]/route.ts
Converting to mp4 Using ffmpeg
The m3u8 file was converted to mp4 format using the following command.
Summary
I hope this serves as a helpful reference for working with audio files.