@@ -306,22 +306,32 @@ ffmpeg -i input.mp4 \
306306 -f mp4 fragmented.mp4
307307```
308308
309- If the source codecs are not already compatible, re-encode instead of copying. For example:
309+ If the source codecs are not already compatible, re-encode instead of copying. For example (h264 and h265) :
310310
311311``` bash
312- ffmpeg -i input.mov \
313- -map 0:v -map 0:a \
312+ ffmpeg -i bbb_sunflower_2160p_60fps_normal.mp4 \
313+ -map 0:v:0 -map 0:a:0 \
314314 -map_metadata -1 \
315315 -sn -dn \
316- -c:v libx264 -preset medium -g 48 -keyint_min 48 \
317- -c:a aac -profile:a aac_low -b:a 128k \
318- -movflags +frag_keyframe+empty_moov+default_base_moof+separate_moof \
319- -f mp4 fragmented.mp4
316+ -c:v libx264 -preset medium -r 30 -g 60 -keyint_min 60 -sc_threshold 0 -bf 0 \
317+ -c:a aac -b:a 160k -ar 48000 -ac 2 \
318+ -movflags +frag_keyframe+empty_moov+default_base_moof \
319+ -f mp4 sunflower-frag.mp4
320+
321+ ffmpeg -i bbb_sunflower_2160p_60fps_normal.mp4 \
322+ -map 0:v:0 -map 0:a:0 \
323+ -map_metadata -1 \
324+ -sn -dn \
325+ -c:v libx265 -preset medium -r 30 -g 60 -keyint_min 60 -sc_threshold 0 -bf 0 \
326+ -c:a aac -b:a 160k -ar 48000 -ac 2 \
327+ -movflags +frag_keyframe+empty_moov+default_base_moof \
328+ -f mp4 sunflower265-frag.mp4
320329```
321330
322331Practical notes:
323332
324333- ` -map 0:v -map 0:a ` keeps only video and audio streams, excluding subtitle and other non-A/V tracks
334+ - ` -map 0:v:0 -map 0:a:0 ` uses first audio stream if multiple exist
325335- ` -sn -dn ` explicitly disables subtitle and data or text streams
326336- ` -map_metadata -1 ` drops container-level metadata from the output
327337- ` +frag_keyframe ` starts a new fragment on keyframes
0 commit comments