Skip to content

Instantly share code, notes, and snippets.

@eduard-sukharev
Last active September 28, 2017 19:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eduard-sukharev/526e6cba8abcc9ce2651 to your computer and use it in GitHub Desktop.
Save eduard-sukharev/526e6cba8abcc9ce2651 to your computer and use it in GitHub Desktop.
Convert VCHD into mp4 with ffmpeg 2.6

FFMpeg Commands for Transcoding MTS video (from AVCHD-Lite Cameras, like Panasonic DMC-TS1/2)

Encoding parameters as for static ffmpeg-2.6.1-static build

720p -> H.264 (x264) video + AAC 128kbps audio:

Medium quality 720p:

ffmpeg -i 00001.MTS -threads 3 -y -vcodec libx264 -qscale 0 -acodec libvo_aacenc -ab 128k -ar 44100 -ac 2 -s 1280x720 -b 1M output.mp4

High quality 720p:

ffmpeg -i 00001.MTS -threads 3 -y -vcodec libx264 -qscale 0 -acodec libvo_aacenc -ab 192k -ar 44100 -ac 2 -s 1280x720 -b 2M output.mp4

Medium quality 1080p:

ffmpeg -i 00001.MTS -threads 3 -y -vcodec libx264 -qscale 0 -acodec libvo_aacenc -ab 128k -ar 44100 -ac 2 -s 1920x1080 -b 1.5M output.mp4

High quality 1080p:

ffmpeg -i 00001.MTS -threads 3 -y -vcodec libx264 -qscale 0 -acodec libvo_aacenc -ab 192k -ar 44100 -ac 2 -s 1920x1080 -b 3M output.mp4

(You could also omit the -s switch to keep the size the same as the input and adjust the -b param to adjust quality more predictably, or leave it out altogether to make ffmpeg automatically determine a good quality)

Concatenate multipart into single mp4

Prepare intermediate containers for concatenation

ffmpeg -i output-p1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts

Concatenate containers

ffmpeg -i "concat:intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc single-output.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment