1. Determine the video format
First determine the video format is or common format, such as: MP4, MKV, MOV… For common video files that can be directly transcoded, if so, go to Step 2; if not, see Step 3.
2. Command line transcoding
The following is the transcoding command
Measure-Command {ffmpeg -vsync 0 -hwaccel qsv -hwaccel_output_format qsv -y -i output.mp4 -c:v h264_nvenc -c:a aac -b:v 1800k -s 1920x1080 -hls_playlist_type vod -hls_time 5 -hls_key_info_file key_info -hls_segment_filename 1080/%06d.ts 1080/index.m3u8 -c:v h264_nvenc -c:a aac -b:v 1024k -s 1280x720 -hls_playlist_type vod -hls_time 5 -hls_key_info_file key_info -hls_segment_filename 720/%06d.ts 720/index.m3u8 -c:v h264_nvenc -c:a aac -b:v 512k -s 720x480 -hls_playlist_type vod -hls_time 5 -hls_key_info_file key_info -hls_segment_filename 480/%06d.ts 480/index.m3u8}
Copy the code
Use WindowsTermimal or powerShell otherwise remove Measure-Command {}. CMD Command tools do not support secondary commands.
3. Video processing
3.1. Processing video clips
If there are multiple videos, you need to merge the videos and go to Step 2. For example, after a DVD video is exported, multiple VOB video files are generated. In this case, you need to merge the videos.
copy /b "VTS_01_1.VOB" + "VTS_01_2.VOB" + "VTS_01_3.VOB" "output.vob"
Copy the code
Tip: VTS_ at the beginning of the file for the video clip, the output. The vob for the final output file, see other video format trac.ffmpeg.org/wiki/Concat…
3.2. Audio processing
If there is no sound after the video is transcoded, you can view the ffMPEG-I video file to check whether the audio format is a common format. For example, AC3 cannot be played and loaded by some players. In this case, you need to convert the video audio to a common format, such as AAC:
ffmpeg -vsync 0 -hwaccel qsv -hwaccel_output_format qsv -y -i output.vob -c:v h264_nvenc -c:a aac output.mp4
Copy the code
You can directly view video clips in audio format. Do not transcode and play without sound before viewing. You should first check video and audio formats.
Other related recommendations
Ts slices are generated using FFmpeg and encrypted using AES-128