FFmpeg settings to convert MTS into MPG for YouTube

2.9k views Asked by At

I would like to discuss the optimal parameters for FFmpeg to convert an MTS video file with the following profile for the upload onto YouTube. YouTube published their suggested resolutions and bitrates settings.

// Input video profile
Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 50 tbc
Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, s16, 256 kb/s

Since YouTube has length restrictions to the videos I also want to cut the original file into pieces.

Here is my current configuration to convert a video. I am running Ubuntu 10.10. with FFmpeg version git-2011-12-31-81980bf.

ffmpeg -ss 00:15:00 -i input.mts -t 00:30:00 -vcodec libx264 -deinterlace -s hd720 -ab 128k -threads 0 output.mp4

I also want to reencode the video since I do not want to upload the large files of the original recording.

1

There are 1 answers

4
llogan On

You probably don't need to re-encode. Youtube will probably accept the resulting file. You can use FFmpeg to split the video without re-encoding:

ffmpeg -ss 00:15:00 -i input.mts -t 00:30:00 -c copy output.mkv

Move -ss as an output option (after -i input.mts) if the offset is inaccurate or doesn't look right. It is more accurate as an output option, because it will decode everything until the given time, but is much slower than -ss as an input option which attempts to immediately seek to the given time. Users of older FFmpeg may have to use -vcodec copy -acodec copy instead of -c copy.