no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Last revision | |||
— | video_conversion [2013/07/11 23:29] – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Video Conversion ====== | ||
+ | * [[faac]] | ||
+ | * [[Handbrake]] | ||
+ | * [[libav]] | ||
+ | * [[mp4box]] | ||
+ | * [[x264]] | ||
+ | |||
+ | ==== Creating a Streamable MP4 ==== | ||
+ | |||
+ | == Convert to Y4M == | ||
+ | |||
+ | * 16x9 | ||
+ | * 480p | ||
+ | |||
+ | First, take the original source and extract the video to a YUV4MPEG container. | ||
+ | |||
+ | < | ||
+ | avconv -i source.mp4 -s hd480 -aspect 16:9 source.y4m | ||
+ | </ | ||
+ | |||
+ | == x264 Y4M == | ||
+ | |||
+ | Next, use x264 to reencode the video. | ||
+ | |||
+ | * medium preset (default) | ||
+ | * high profile h264 | ||
+ | * two-pass encoding | ||
+ | * constant bit rate | ||
+ | |||
+ | < | ||
+ | x264 --preset medium --profile high --pass 1 --bitrate 1000 --vbv-bufsize 2000 -o video.264 source.y4m | ||
+ | x264 --preset medium --profile high --pass 2 --bitrate 1000 --vbv-bufsize 2000 -o video.264 source.y4m | ||
+ | </ | ||
+ | |||
+ | When you're happy with the outcome, you can come back and re-encode the video at a higher quality rate. | ||
+ | |||
+ | < | ||
+ | x264 --preset placebo --profile high --pass 1 --bitrate 1000 --vbv-bufsize 2000 -o video.264 source.y4m | ||
+ | x264 --preset placebo --profile high --pass 2 --bitrate 1000 --vbv-bufsize 2000 -o video.264 source.y4m | ||
+ | </ | ||
+ | |||
+ | == AAC audio re-encode == | ||
+ | |||
+ | Next, source the original audio to WAV so that we can re-encode it at the target bit rate, which is also fixed. | ||
+ | |||
+ | * Source to WAV | ||
+ | * WAV to AAC | ||
+ | |||
+ | < | ||
+ | avconv -i source.mp4 audio.wav | ||
+ | avconv -i audio.wav -b 96k audio.m4a | ||
+ | </ | ||
+ | |||
+ | == MP4 Muxing (MP4box) == | ||
+ | |||
+ | Next, use MP4Box to join the audio and video together, as well as specify the exact framerate, and setting the interframe rate to a smaller value than normal to also aid streaming. | ||
+ | |||
+ | < | ||
+ | mp4box -add video.264 -add audio.m4a -fps 25 -inter 500 mp4box.mp4 | ||
+ | </ | ||
+ | |||
+ | == qt-faststart == | ||
+ | |||
+ | Finally, move all the metadata about the MP4 to the front of the file, so that clients can know about the souce material. | ||
+ | |||
+ | qt-faststart mp4box.mp4 qt.mp4 |