Created
September 1, 2020 02:33
-
-
Save ryos36/e607286ae0bc34c1f6ede31aa067cea7 to your computer and use it in GitHub Desktop.
gstreamer による ts から mp4 への変換プログラム。ただし、音声が抜けてしまう。
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/sh | |
FORCE_MODE=0 | |
if [ "$1" = "-f" ]; then | |
FORCE_MODE=1 | |
shift | |
fi | |
if [ $# -eq 0 ]; then | |
echo Usage $0 '<video>.ts' | |
exit 1 | |
fi | |
if [ $# -eq 1 ]; then | |
BASENAME=`basename -s .ts $1` | |
IN_TS_FILE=${BASENAME}.ts | |
OUT_MP4_FILE=${BASENAME}.mp4 | |
else | |
IN_TS_FILE=$1 | |
OUT_MP4_FILE=$2 | |
fi | |
if [ ! -e $IN_TS_FILE ]; then | |
echo $IN_TS_FILE is not exist | |
exit 2 | |
fi | |
if [ ! -s $OUT_MP4_FILE ]; then | |
echo $OUT_MP4_FILE is Zero | |
rm $OUT_MP4_FILE | |
fi | |
if [ -e $OUT_MP4_FILE ]; then | |
echo $OUT_MP4_FILE is already exist | |
if [ $FORCE_MODE -eq 1 ]; then | |
echo but, Overwrite!! | |
else | |
exit 2 | |
fi | |
fi | |
export GST_DEBUG_DUMP_DOT_DIR=dot | |
gst-launch-1.0 filesrc location=${IN_TS_FILE} \ | |
! progressreport \ | |
! tsdemux \ | |
! h264parse \ | |
! mp4mux name=mux \ | |
! filesink location=${OUT_MP4_FILE} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment