-
-
Save fuba/ea884de853f8f2c7aa79 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# | |
# Usage: mpegts2h264.sh <src.ts> <dst.mp4> | |
# | |
program_no=$(ffmpeg -i $1 2>&1 | grep Program | head -n 1 | awk '{ print $2 }') | |
video_sid=$(ffmpeg -i $1 2>&1 | grep Stream | grep Video | sed -e "s/^.*Stream #0\.[0-9]\[0x\([0-9a-f][0-9a-f][0-9a-f]\)\].*$/\1/g") | |
audio_sid=$(ffmpeg -i $1 2>&1 | grep Stream | grep Audio | sed -e "s/^.*Stream #0\.[0-9]\[0x\([0-9a-f][0-9a-f][0-9a-f]\)\].*$/\1/g") | |
echo $video_sid | |
echo $audio_sid | |
gst-launch-1.0 filesrc location=./$1 ! progressreport ! \ | |
tsdemux program-number=$program_no name=demuxer \ | |
demuxer.video_0$video_sid ! video/mpeg ! queue max-size-time=0 max-size-buffers=0 ! \ | |
mpegvideoparse ! omxmpeg2videodec ! deinterlace ! \ | |
videoconvert ! omxh264enc target-bitrate=2500000 control-rate=variable ! \ | |
video/x-h264,width=1280,height=720,stream-format=byte-stream,profile=high ! h264parse ! mux. \ | |
demuxer.audio_0$audio_sid ! audio/mpeg ! queue max-size-time=0 max-size-buffers=0 ! \ | |
aacparse ! avdec_aac ! audioresample ! audioconvert dithering=0 ! voaacenc bitrate=128000 ! \ | |
mp4mux streamable=true name=mux ! filesink location=$2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/fuba/ea884de853f8f2c7aa79/687b1e85ae49f5cb96723166d3cc7a6df3a45c91
29分10秒で完了。584.2MB
http://pi.fuba.me/PugYdTQ7ralH8fBx8AaTs.png
インターレースは解除されたけど、VBRなのでファイルサイズはビットレートを下げた意味ない感じがする。画質はちょっとつらい。