yuv444和yuv420互转
yuv444转yuv420
ffmpeg -threads 16 -s 1920*1080 -pix_fmt yuv444p10le -i 1.yuv -pix_fmt yuv420p10le 2.yuv
yuv420转yuv444
ffmpeg -threads 16 -s 1920*1080 -pix_fmt yuv420p -i 1.yuv -pix_fmt yuv444p 2.yuv
https://blog.youkuaiyun.com/qq_27956971/article/details/56483380
yuv 8bit和10bit互转
10bit转8bit
ffmpeg -threads 16 -s 1920x1080 -pix_fmt yuv444p10le -i 1.yuv -pix_fmt yuv420p 2.yuv
8bit转10bit
ffmpeg -threads 16 -s 1920x1080 -pix_fmt yuv420p -i 1.yuv -pix_fmt yuv444p10le 2.yuv
https://blog.youkuaiyun.com/baoyongshuai1509/article/details/83927538
.h265和yuv互转
.h265转yuv
ffmpeg -i xxx.h265 -c:v rawvideo -an xxx.yuv
https://blog.youkuaiyun.com/Mengxihe29/article/details/52584708
无损yuv转.h265:
ffmpeg -r 25 -s 1920x1080 -pix_fmt yuv420p -i xxx.yuv -vcodec libx265 -x265-params "preset=medium:lossless" -g 500 xxx.h265
将视频的每一帧保存成单独的yuv
mp4解单帧yuv:
ffmpeg -threads 16 -i test.mp4 -f segment -segment_time 0.01 -vf pp=lb -vsync 0 -pix_fmt yuv420p ./frame/%06d.yuv
https://blog.youkuaiyun.com/BigerBang/article/details/107953550
yuv解单帧yuv:
ffmpeg -threads 16 -s 1920x1080 -pix_fmt yuv420p -i test.yuv -f segment -segment_time 0.01 -pix_fmt yuv420p ./frame/%06d.yuv
x264编码
yuv先转bin再转mp4
./x264 --preset slow --keyint infinite --tune ssim --bframes 7 --input-res 1920x1088 --fps 25 --crf 8 xxx.yuv -o xxx.bin
./ffmpeg -y -i xxx.bin -vcodec copy xxx.mp4
exr转yuv转mp4
ffmpeg -i ./seq_v001.%04d.exr -c:v libx265 -pix_fmt yuv420p ./out.mp4
https://superuser.com/questions/512509/convert-exr-file-sequence-with-ffmpeg-and-x264
原始的:
D:\x00467856\sdr2hdrwork\bin\ffmpeg -y -threads 8 -s %width%x%height% -framerate 1 -pix_fmt yuv420p10le -i %input_path%\%filename%.yuv -vcodec libx265 -x265-params "input-depth=10:pass=1:input-res=%width%x%height%:preset=6:open-gop=0:b-adapt=0:bitrate=%br%:fps=25:keyint=125:sao=1:amp=1:log2-max-poc-lsb=6:hrd=1:hdr=1:master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,20):max-cll="898,315":sar=1:videoformat=5:colorprim=9:transfer=16:colormatrix=9:chromaloc=2:output-depth=10:frame-threads=8" -f mp4 -movflags faststart %output_path%\%filename%.mp4
exr直接转mp4:
ffmpeg -y -threads 8 -s 1920x1080 -pix_fmt yuv420p10le -i %06d_out.exr -vcodec libx265 -x265-params "input-depth=10:pass=1:input-res=1920x1080:preset=6:open-gop=0:b-adapt=0:bitrate=5000:fps=25:keyint=125:sao=1:amp=1:log2-max-poc-lsb=6:hrd=1:hdr=1:master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,20):max-cll="898,315":sar=1:videoformat=5:colorprim=9:transfer=16:colormatrix=9:chromaloc=2:output-depth=10:frame-threads=8" -f mp4 -movflags faststart test.mp4
exr转yuv
(暗输出)
ffmpeg -y -threads 8 -apply_trc smpte2084 -framerate 25 -i %06d_out.exr -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2" -c:v rawvideo -pix_fmt yuv420p10le -color_primaries 9 -colorspace 9 -color_trc 16 ../yuv_ghent/out.yuv
(正常亮度,但无PQ)
ffmpeg -y -threads 8 -apply_trc bt2020_10bit -framerate 25 -i %06d_out.exr -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2" -c:v rawvideo -pix_fmt yuv420p10le -color_primaries 9 -colorspace 9 -color_trc 16 ../yuv_ghent/out.yuv
yuv转mp4
ffmpeg -y -threads 8 -s 1920x1080 -framerate 25 -pix_fmt yuv420p10le -i out.yuv -vcodec libx265 -x265-params "input-depth=10:pass=1:input-res=1920x1080:preset=6:open-gop=0:b-adapt=0:bitrate=5000:fps=25:keyint=125:sao=1:amp=1:log2-max-poc-lsb=6:hrd=1:hdr=1:master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,20):max-cll="898,315":sar=1:videoformat=5:colorprim=9:transfer=16:colormatrix=9:chromaloc=2:output-depth=10:frame-threads=8" -f mp4 -movflags faststart test.mp4
ffmpeg - 将.exr序列转换为.mp4时,得到暗输出
http://www.it1352.com/752150.html
其它:
ffmpeg -y -threads 8 -i Sample_HDR.mp4 -pix_fmt yuv420p10le -vf scale=out_color_matrix=bt2020:out_h_chr_pos=0:out_v_chr_pos=0,format=yuv420p10 -c:v libx265 -preset medium -x265-params :colorprim=bt2020:transfer=smpte-st-2048:colormatrix=bt2020nc:master-display="G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(12000000,200)":max-cll=0,0:repeat-headers -c:a copy -max_muxing_queue_size 4096 "Sample_HDR-encode.mkv"
https://forum.doom9.org/showthread.php?t=175227
exr转png
ffmpeg -apply_trc bt709 -i linear.exr bt709.png
ffmpeg -apply_trc smpte2084 -i linear.exr smpte2084.png
ffmpeg -apply_trc iec61966_2_1 -i linear.exr sRGB.png
ffmpeg源码
https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/exr.c
ffmpeg -apply_trc smpte2084 -color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020_ncl -i 000001_out.exr 001.png
https://forum.videohelp.com/threads/380991-ffmpeg-x264-RGB-to-YUV
FFMpeg command line for HDR encoding to SMPTE 2084 (PQ EOTF) standards with VP9
https://developers.google.com/media/vp9/hdr-encoding/