/
09_ffmpeg_transcode_only_4k.sh
executable file
·41 lines (35 loc) · 2.15 KB
/
09_ffmpeg_transcode_only_4k.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
#
# Copyright 2020-2021 Xilinx, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# The U30 Video SDK solution supports real-time decoding and encoding of 4k streams with the following notes:
# - The U30 video pipeline is optimized for live-streaming use cases. For 4k streams with bitrates significantly higher than the ones typically used for live streaming, it may not be possible to sustain real-time performance.
# - When decoding 4k streams with a high bitrate, increasing the number of entropy buffers using the -entropy_buffers_count option can help improve performance
# - When encoding raw video to 4k, set the -s option to 3840x2160 to specify the desired resolution.
# - When encoding 4k streams to H.264, the -slices option is required to sustain real-time performance. A value of 4 is recommended. This option is not required when encoding to HEVC.
# - The lookahead feature is not supported for 4k. FFmpeg will give an error if -lookahead_depth is enabled when encoding to 4k.
# This script accepts an 8-bit, pre-encoded HEVC file and will send the encoded H.264 output to /tmp/xil_4k_xcode.mp4 at a rate of 20Mbps.
# You may edit this to enable other output bitrates (-b:v).
# You may change the target codecs by changing:
# the input codec from (-c:v mpsoc_vcu_hevc) to (-c:v mpsoc_vcu_h264) for decoding from H264
# the output codec from (-c:v mpsoc_vcu_h264) to (-c:v mpsoc_vcu_hevc) for encoding to HEVC
if [ $# -ne 1 ]
then
echo "Incorrect arguments supplied"
echo "Usage: $(basename $0) <2160p60 HEVC clip>"
exit 1
fi
ffmpeg -c:v mpsoc_vcu_hevc -i $1 \
-b:v 20M -c:v mpsoc_vcu_h264 -slices 4 -f mp4 -y /tmp/xil_4k_xcode.mp4