ffmpeg yuv处理

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.csdn.net/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.csdn.net/baoyongshuai1509/article/details/83927538
 

.h265和yuv互转

.h265转yuv
ffmpeg -i xxx.h265 -c:v rawvideo -an xxx.yuv
https://blog.csdn.net/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.csdn.net/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/
 

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

WX Chen

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值