|
| 1 | +# bili-pc-mp4 |
| 2 | + |
| 3 | +[](https://www.npmjs.com/package/bili-pc-mp4) |
| 4 | + |
| 5 | + |
| 6 | +[](https://github.com/yinyanfr/bili-pc-mp4/releases/latest) |
| 7 | + |
| 8 | +[中文文档](../README.md) | English Document |
| 9 | + |
| 10 | +`bili-pc-mp4` is a tool for converting videos downloaded from the "Bilibili Desktop Client" (Windows (non-UMP), Mac version) into MP4 format. |
| 11 | + |
| 12 | +Please note that `bili-pc-mp4` is not a downloader, and you need to first use the "Bilibili Desktop Client" to perform "offline caching" of the videos. |
| 13 | + |
| 14 | +`bili-pc-mp4 only` supports videos downloaded using the "Bilibili Desktop Client" and does not support other platform clients. |
| 15 | + |
| 16 | +You need to first [install ffmpeg](./ffmpeg.en.md). |
| 17 | + |
| 18 | +## :star2: Features |
| 19 | + |
| 20 | +- Decrypts and merges videos without loss of audio and video quality. |
| 21 | +- Supports batch conversion of multiple videos. |
| 22 | +- Supports viewing video information. |
| 23 | +- Simple and easy-to-use command-line tool. |
| 24 | +- Low memory usage. |
| 25 | + |
| 26 | +## :wrench: Command-Line Tool |
| 27 | + |
| 28 | +### Convert Videos |
| 29 | + |
| 30 | +You can use the simple command at the top of the page or use the complete command: |
| 31 | + |
| 32 | +```bash |
| 33 | +npx bili-pc-mp4 convert -i ~/Movies/bilibili -o ~/Movies/converted |
| 34 | +``` |
| 35 | + |
| 36 | +| Name | Type | Description | |
| 37 | +| ------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 38 | +| `--input, -i` | Path | Specifies the location of the videos to be converted. It can be a folder containing a single video or multiple videos. | |
| 39 | +| `--output, -o` | Path | Specifies the output location for the videos. Defaults to the current location. | |
| 40 | +| `--page-number, -p` | | Whether to include the page number (分p) before the output video filename. | |
| 41 | +| `--silence, -s` | | Whether to suppress terminal output. | |
| 42 | +| `--buffer-size, -b` | Number | Specifies the block size (in KB) for reading file streams. Defaults to 64 MB. For effective decryption, this value should not be less than 16 KB. | |
| 43 | + |
| 44 | +You can input the following command to see complete help information and usage examples: |
| 45 | + |
| 46 | +```bash |
| 47 | +npx bili-pc-mp4 help |
| 48 | +``` |
| 49 | + |
| 50 | +### View Video Information |
| 51 | + |
| 52 | +```bash |
| 53 | +npx bili-pc-mp4 list ~/Movies/bilibili |
| 54 | +``` |
| 55 | + |
| 56 | +## :book: Using as a Library |
| 57 | + |
| 58 | +You can also use `bili-pc-mp4` as a library; bili-pc-mp4 uses CommonJS. |
| 59 | + |
| 60 | +`bili-pc-mp4` has complete JSDoc, and its features and options are consistent with the command-line. |
| 61 | + |
| 62 | +```bash |
| 63 | +npm i bili-pc-mp4 |
| 64 | +``` |
| 65 | + |
| 66 | +```typescript |
| 67 | +import { listVideos, processFolder } from 'bili-pc-mp4'; |
| 68 | + |
| 69 | +// View video information |
| 70 | +await listVideos('./bilibili'); |
| 71 | + |
| 72 | +// Convert videos |
| 73 | +await processFolder('./bilibili', { |
| 74 | + output: './converted', |
| 75 | + pageNumber: true, |
| 76 | + silence: true, |
| 77 | + bufferSize: 64 * 1024, |
| 78 | +}); |
| 79 | +``` |
0 commit comments