我正在使用FFmpeg创建CMAF流,并使用FFMpeg的PUT
方法将其上传到 AWS 资源。
上传清单和细分时,我需要传递Content-Type
标头。
我有3种文件类型:
application/x-mpegURL
:m3u8清单
application/dash+xml
:mpd清单
video/mp4
:视频片段
当前,所有类型都在 AWS 资源中设置为Binary - octet-stream
。
由于我将上传大量文件,因此无法在上传文件后使用AWS Lambda函数设置正确的内容类型。
[https @ 0x555fe7a7d1c0] Opening 'https://XXXX.YYYY.amazonaws.com/chunk-stream0-00001.mp4' for writing
[https @ 0x555fe7a7d0c0] request: PUT /chunk-stream0-00001.mp4 HTTP/1.1
Transfer-Encoding: chunked
User-Agent: Lavf/58.28.100
Accept: */*
Connection: keep-alive
Host: XXXXX.YYYY.amazonaws.com
Icy-MetaData: 1
我尝试了FFMpeg的静态构建和主分支。 我尝试了不同的方法来传递内容类型,但没有成功:
-mime_type 1 -headers "Content-type: video/mp4\r\n"
-mime_type "video/mp4,application/dash+xml,application/x-mpegURL"
-content_type application/dash+xml
-multiple_requests 1 -headers "a:b" -icy 0
./ffmpeg -re -i ~/videos/BigBuckBunny.mp4 -loglevel debug \
-map 0 -map 0 -map 0 -c:a aac -c:v libx264 -tune zerolatency \
-b:v:0 2000k -s:v:0 1280x720 -profile:v:0 high -b:v:1 1500k -s:v:1 640x340 -profile:v:1 main -b:v:2 500k -s:v:2 320x170 -profile:v:2 baseline -bf 1 \
-keyint_min 24 -g 24 -sc_threshold 0 -b_strategy 0 -ar:a:1 22050 -use_timeline 1 -use_template 1 -window_size 5 \
-adaptation_sets "id=0,streams=v id=1,streams=a" -hls_playlist 1 -seg_duration 3 -streaming 1 \
-strict experimental -lhls 1 -remove_at_exit 0 -master_m3u8_publish_rate 3 \
-f dash -method PUT -http_persistent 1 https://example.com/manifest.mpd
任何帮助将不胜感激。
参考: this