Created
November 25, 2023 12:55
-
-
Save danimal141/d6ddf5c2af9002a64dbf8ca52b3b6067 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# コマンドライン引数から入力ファイル名を取得 | |
if [ "$#" -ne 1 ]; then | |
echo "使用方法: $0 [input-file]" | |
exit 1 | |
fi | |
INPUT_FILE="$1" | |
# 出力される動画と音声のrawファイルの名前を定義 | |
VIDEO_RAW="video.h264" | |
AUDIO_RAW="audio.aac" | |
# 最終的な出力ファイルの名前を定義 | |
OUTPUT_FILE="output.mp4" | |
# 動画と音声の抽出 | |
MP4Box -raw 1 "$INPUT_FILE" -out $VIDEO_RAW | |
MP4Box -raw 2 "$INPUT_FILE" -out $AUDIO_RAW | |
# 抽出した動画と音声を結合 | |
MP4Box -add $VIDEO_RAW -add $AUDIO_RAW $OUTPUT_FILE | |
# 中間ファイルの削除 | |
rm $VIDEO_RAW $AUDIO_RAW | |
echo "処理が完了しました。出力ファイル: $OUTPUT_FILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment