ffmpeg - Video - TS Files

TS Files


# Get format_name.

ffprobe -v quiet -show_entries format=format_name -of default=noprint_wrappers=1:nokey=1 "input.ts"
video_codec=$(ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "input.ts" | uniq)
video_format=$(ffprobe -v error -select_streams v:0 -show_entries format=format_name -of default=noprint_wrappers=1:nokey=1 "input.ts" | uniq)
 
# If video format is mpegts then, will be extremely slow to convert, so first convert to x264 format.
if [[ "$video_format" == "mpegts" ]]; then
# Converts the video to x264, and copies audio as is.
ffmpeg -i "input.ts" -map 0 -c:v libx264 -c:a copy output.mkv
 
# Converts the video to x264, and copies audio as is, and copies Subtitles as is.
ffmpeg -i "input.ts" -c:v libx264 -c:a copy -c:s copy 0.mkv
 
# Converts the video to x264, and audio to Vorbis.
ffmpeg -i "input.ts" -c:v libx264 0.mkv
 
# Copies the video as is, mpeg2video, and also copies the audio and subtitles as is.
ffmpeg -i "input.ts" -map 0 -c copy 0.mkv
 
 
fi

ffmpeg -i "0.mkv" -c:v libx264 -profile:v high -level:v 4.2 -b:v 8M -r 30 -s 1920x1080 -c:a aac -b:a 384k -ar 48000 -preset slow -f mp4 1.mp4
ffmpeg -i "0.mkv" -c:v libx264 -profile:v high -level:v 4.2 -b:v 8M -r 30 -s 1920x1080 -channel_layout:a:0 "5.1(side)" -c:a aac -ac 6 -b:a 384k -ar 48000 -preset slow -f mp4 1.mp4
ffmpeg -i "0.mkv" -c:v libx264 -profile:v high -level:v 4.2 -b:v 8M -r 30 -s 1920x1080 -channel_layout:a:0 "5.1(side)" -c:a aac -ac 6 -b:a 384k -ar 48000 -preset slow -f mp4 1.mkv
ffmpeg -i "0.mkv" -c:v libx265 -profile:v high -level:v 4.2 -b:v 8M -r 30 -s 1920x1080 -channel_layout:a:0 "5.1(side)" -c:a aac -ac 6 -b:a 384k -ar 48000 -preset slow -f mp4 1.mkv
ffmpeg -i "0.mkv" -c:v libx265 -profile:v high -pix_fmt yuv420p10le -level:v 4.2 -b:v 8M -r 30 -s 1920x1080 -channel_layout:a:0 "5.1(side)" -c:a aac -ac 6 -b:a 384k -ar 48000 -preset slow -f mp4 1.mkv
ffmpeg -i "0.mkv" -c:v libx265 -profile:v main10 -pix_fmt yuv420p10le -level:v 4.2 -b:v 8M -r 30 -s 1920x1080 -channel_layout:a:0 "5.1(side)" -c:a aac -ac 6 -b:a 384k -ar 48000 -preset slow -f mp4 1.mkv
ffmpeg -i "0.mkv" -c:v libx265 -crf 23 -profile:v main10 -pix_fmt yuv420p10le -level:v 4.2 -b:v 8M -r 30 -s 1920x1080 -channel_layout:a:0 "5.1(side)" -c:a aac -ac 6 -b:a 384k -ar 48000 -preset slow -f mp4 1.mkv
ffmpeg -i "0.mkv" -c:v libx265 -crf 23 -profile:v main10 -pix_fmt yuv420p10le -level:v 4.2 -b:v 8M -r 30 -s 1920x1080 -channel_layout:a:0 "5.1(side)" -c:a aac -ac 6 -b:a 384k -ar 48000 -preset slow -f mp4 1.mp4
ffmpeg -i "0.mkv" -c:v libx265 -crf 23 -profile:v main -pix_fmt yuv420p10le -level:v 4.2 -b:v 8M -r 30 -s 1920x1080 -channel_layout:a:0 "5.1(side)" -c:a aac -ac 6 -b:a 384k -ar 48000 -preset slow -f mp4 1.mkv
ffmpeg -i "0.mkv" -c:v libx265 -crf 23 -profile:v main -pix_fmt yuv420p10le -level:v 4.2 -b:v 8M -r 30 -s 1920x1080 -channel_layout:a:0 "5.1(side)" -c:a aac -ac 6 -b:a 384k -ar 48000 -preset slow -f matroska 1.mkv
ffmpeg -i "0" -c:v libx265 -crf 23 -profile:v main10 -pix_fmt yuv420p10le -level:v 4.2 -b:v 8M -r 30 -s 1920x1080 -channel_layout:a:0 "5.1(side)" -c:a aac -ac 6 -b:a 384k -ar 48000 -preset slow -f matroska 1.mkv
 
ffmpeg -i "0.mkv" -c:v libx264 -profile:v high -level:v 4.2 -b:v 8M -r 30 -s 1920x1080 -channel_layout:a:0 "5.1(side)" -c:a aac -ac 6 -b:a 384k -ar 48000 -preset slow -f mp4 1.mp4
ffmpeg -i "0.mkv" -c:v libx264 -profile:v high -level:v 4.2 -b:v 8M -r 30 -s 1920x1080 -channel_layout:a:0 "5.1(side)" -c:a aac -ac 6 -b:a 384k -ar 48000 -preset slow -f mp4 1.mkv
ffmpeg -i "0.mkv" -c:v libx264 -profile:v high -level:v 4.2 -b:v 8M -r 30 -s 1920x1080 -channel_layout:a:0 "5.1(side)" -c:a aac -ac 6 -b:a 384k -ar 48000 -preset slow -f matroska 1.mkv
ffmpeg -i "0.mkv" -c:v libx264 -profile:v high -level:v 4.2 -b:v 8M -r 30 -s 1920x1080 -channel_layout:a:0 "5.1(side)" -c:a aac -ac 6 -b:a 384k -ar 48000 -preset slow -f matroska 1.mkv
ffmpeg -i "0.mkv" -c:v libx265 -profile:v main10 -level:v 4.2 -b:v 8M -r 30 -vf scale=1920x1080:flags=lanczos -channel_layout:a:0 "5.1(side)" -c:a aac -ac 6 -b:a 384k -ar 48000 -preset slow -f matroska 1.mkv
ffmpeg -i "0.mkv" -c:v libx265 -profile:v main10 -pix_fmt yuv420p10le -level:v 4.2 -b:v 8M -r 30 -vf scale=1920x1080:flags=lanczos -channel_layout:a:0 "5.1(side)" -c:a aac -ac 6 -b:a 384k -ar 48000 -preset slow -f matroska "1.mkv"
 
ffmpeg -i "0.mkv" -c:v libx265 -b:v 5000k -bufsize 5000k -maxrate 5000k -crf 23 -profile:v main10 -b:v 8M -r 30 -c:a aac -b:a 384k -ar 48000 -preset slow "1.mkv"