T3adda direct lel contenu

Commandes FFmpeg elli kol mosta3mel Mac ynajem ycopihom

Cheat sheet FFmpeg mjarrab l-macOS: remux MKV l-MP4, 5arrej sout, 9oss vidéo men ghir ré-encodage, w compressi b-matériel VideoToolbox.

Bil mokhtasar

  • Copie de flux (-c copy) ta3mel remux MKV l-MP4 f-thweni b-zéro perte de qualité w men ghir ta3ab batterie.
  • Encodage matériel b-hevc_videotoolbox yesta3mel direct Media Engine mta3 Apple Silicon l-compression sri3a.
  • Ta9sis vidéo men ghir ré-encodage yotlob wa9fa 3la keyframes, elli ynajem ya3mel décalage sghir fel bideya.
  • MacLC ya3mel el 7ajet hedhi lkol automatique en temps réel wa9t el lecture.
Fi hal saf7a
  1. Kifech tfettesh flux w métadonnées fichier vidéo?
  2. Kifech ta3mel remux MKV l-MP4 men ghir ré-encodage?
  3. Kifech t5arrej el sout men fichier vidéo?
  4. Kifech t9oss vidéo men ghir ma tdha33ef el qualité?
  5. Kifech tcompressi vidéo b-encodage matériel Apple Silicon?
  6. Kifech t5arrej wella ta7ra9 sous-titres b-FFmpeg?
  7. Chnowa ta3mel tawwa

Anfa3 commandes FFmpeg 3al Mac houma remuxing el conteneur, ta9sis flux men ghir perte, ta5rij el sout, w compression b-accélération matérielle. F-blast ma testanna sweye3 l-logiciels montage y3awdou yencodiw vidéowatek, FFmpeg ynajem ybadel flux média mawjoudin f-thweni ki testa3mel options Terminal es-s7a7.

Ta7t hedha cheat sheet mnaddhem w mjarrab masnou3 5issisan l-macOS w Apple Silicon. Kol recette testa3mel syntaxe s7i7a, tetfada ré-encodage zeyed win momken, w tfasser chnowa ta3mel kol option bech tefhem b-dhabt chnowa ya3mel Terminal f-fichiers mte3ek.

Kifech tfettesh flux w métadonnées fichier vidéo?

9bal ma tbadel wella t9oss fichier média, dima thabbet chnouma el flux, codecs, w pistes elli m5abbiyin fih. Tnajem ta3mel hedha b-ffprobe, outil analyse flux elli yji m3a FFmpeg:

ffprobe -hide_banner -i input.mp4

Tafsir el options:

  • ffprobe: Ychaghgel outil analyse flux elli yji m3a FFmpeg.
  • -hide_banner: Y5abbi klem copyright w config el build, w y5alli sortie Terminal ndhifa w ma9riya.
  • -i input.mp4: Y7added chemin fichier média el asli mte3ek.

Terminal bech y5arrej liste mfassla lel fichier. Chouf el stoura mel louta mektoub fihom Stream #0:0, Stream #0:1, w hakka. Bech tchouf ken piste el vidéo H.264, HEVC, wella AV1, espace couleur (kima BT.709 l-SDR wella BT.2020 l-HDR), codec el sout (AAC, AC-3, FLAC), w ay pistes sous-titres intégrées.

Ken t7eb sortie JSON ndhifa tnajem testa3melha f-scripts, executi:

ffprobe -v error -show_format -show_streams -print_format json input.mkv

L-char7 a3ma9 l-tafsir couleurs primaires w caractéristiques transfert, chouf kifech testa3mel ffprobe.

Kifech ta3mel remux MKV l-MP4 men ghir ré-encodage?

Ken QuickTime Player yorfdh y7ell fichier MKV fih vidéo H.264 wella HEVC 3adiya, ma test7a9ech t3awed tencodi el vidéo. Tnajem t3awed t7ott el flux f-conteneur MP4 men ghir perte f-2 l-3 thweni:

ffmpeg -i input.mkv -map 0:v -map 0:a -c copy -movflags +faststart output.mp4

Tafsir el options:

  • -i input.mkv: Y7added el fichier el asli elli t7eb tbadlou.
  • -map 0:v -map 0:a: Y7afedh 3la kol piste vidéo w audio. Sous-titres texte f-MKV (SRT, ASS) ma ynajmouch yetcopiw l-MP4 kima houma, donc m5alliyin barra hne; badelhom b--map 0:s -c:s mov_text ken test7a9hom.
  • -c copy: Ycopi el flux kima houma, men ghir ma ydécompresi wella y3awed ycompresi 7atta image.
  • -movflags +faststart: Yna99el métadonnées index conteneur MP4 (atome moov) men a5er el fichier l-awwlou. Hedha y5alli el vidéo tebda fisa3 f-QuickTime wella 3al réseau 9bal ma yet9ra el fichier lkol.
  • output.mp4: Y7added esm w format fichier el 5orja.

5ater -c copy yfot l-encodeur bel kamel, el 3amaliya hedhi ta3ti 0.0% perte de qualité w ma tekouch batterie 3al MacBook. Bech tefhem 3lech conteneurs ya3mlou machakel compatibilité, a9ra MKV vs MP4 w guide kifech tbadel MKV l-MP4 3al Mac.

Kifech t5arrej el sout men fichier vidéo?

Ken t7eb t5abbi piste mousi9a, mou7adhra, wella podcast men fichier vidéo men ghir ma t5alli données el vidéo el kbar, tnajem t5arrej piste el sout direct.

Ta5rij flux el sout el asli men ghir perte:

ffmpeg -i input.mp4 -vn -c:a copy output.aac

Tafsir el options:

  • -i input.mp4: El vidéo el asliya elli fiha piste el sout.
  • -vn: Ytaffi tasjil el vidéo (“video none”), w ytayech flux el vidéo bech yo93od es-sout kahaw.
  • -c:a copy: Ycopi flux el sout direct men ghir ré-encodage.
  • output.aac: Fichier audio el 5orja (esta3mel .aac ken es-sout el asli AAC, wella .m4a ken t7eb boite compatible m3a Apple).

Badel es-sout l-MP3 b-qualité 3alya:

Ken es-sout el asli f-format ma ya9rahouch poste el karhba wella appareil 9dim, badlou l-MP3 bitrate variable b-qualité 3alya:

ffmpeg -i input.mp4 -vn -c:a libmp3lame -q:a 2 output.mp3

Tafsir el options:

  • -c:a libmp3lame: Ye5tar encodeur MP3 open-source LAME.
  • -q:a 2: Y7ott niveau qualité VBR mta3 LAME f-2 (ta9rib 190 kbps mou3addal), elli ya3ti qualité sout behia b-taille sghira.

Kifech t9oss vidéo men ghir ma tdha33ef el qualité?

Ta9sis ajza2 zeyda men awwel wella a5er clip vidéo ykammel f-thweni b-copie de flux.

ffmpeg -ss 00:01:30 -to 00:03:00 -i input.mp4 -c copy output.mp4

Tafsir el options:

  • -ss 00:01:30: Y7added wa9t el bideya (1 d9i9a w 30 thanya fel vidéo). Ki t7ott -ss 9bal -i, tcha33el ba7th sari3 mabni 3la index keyframes el conteneur.
  • -to 00:03:00: Y7added wa9t el nihaya (y9oss el vidéo f-3 d9aye9 b-dhabt mel fichier el asli).
  • -i input.mp4: Y7added vidéo el entrée.
  • -c copy: Ycopi el 9at3a el ma5toura men ghir décodage wella ré-encodage.
  • output.mp4: Fichier el 5orja el ma9sous.

El char9 el mohemm mta3 el keyframe:

Ki testa3mel -c copy, FFmpeg ma ynajamch y9oss vidéo 3la ay image wa7adha. Codecs compressés kima H.264 w HEVC ynaddhmou el vidéo f-Groups of Pictures (GOPs). El tsawer el kamlin el wa7idin houma keyframes (I-frames); kol el images elli fel west (P-frames w B-frames) yousfou ken el far9 bin keyframes.

Ken wa9tek -ss 00:01:30 yti7 bin keyframes, FFmpeg lezmou yebda el copie men a9reb keyframe 9ablou. Ken t7awel tforci 9at3a f-west GOP men ghir ré-encodage, el lecteurs bech ywarriw images ferghin wella wa9fin 7atta youssel el keyframe ej-jey. Ken test7a9 9at3a da9i9a b-l’image, lezmek t3awed tencodi el ma9ta3. T3allem akther f-chnouwa howa el keyframe.

Kifech tcompressi vidéo b-encodage matériel Apple Silicon?

Ki test7a9 tsa88er fichier caméra 4K kbir wella enregistrement écran l-taille tetpartaja, isti3mal cœurs CPU m3a encodeurs logiciels kima libx265 ynajem yekhou sweye3. Puces Apple Silicon M-series fihom encodeurs matériels da5el Media Engine, accessible b-framework VideoToolbox mta3 macOS.

Compression b-Apple VideoToolbox HEVC (H.265):

ffmpeg -i input.mov -c:v hevc_videotoolbox -b:v 4000k -tag:v hvc1 -c:a aac -b:a 192k output.mp4

Tafsir el options:

  • -i input.mov: Enregistrement el asli el kbir wella master montage.
  • -c:v hevc_videotoolbox: Y9oul l-FFmpeg yfot el CPU w yesta3mel encodeur matériel HEVC mta3 puce M1, M2, M3, wella M4.
  • -b:v 4000k: Y7ott bitrate el vidéo el mastahdef f-4,000 kbps (4 Mbps), elli ya3ti qualité momteza l-1080p w streaming 4K 5fif.
  • -tag:v hvc1: Mohemm barcha l-compatibilité Apple. Ytaggi flux el vidéo b-code FourCC hvc1, bech yadhmen elli el vidéo te5dem nativement f-QuickTime Player, Safari, w Apple TV men ghir écran ak7al.
  • -c:a aac: Ycompressi es-sout b-codec audio AAC el 3adi.
  • -b:a 192k: Y7ott bitrate es-sout f-192 kbps stéréo ndhif.
  • output.mp4: Fichier MP4 el compressé el jdid.

Compression b-Apple VideoToolbox H.264:

L-a9sa compatibilité m3a smart TVs 9dom w systèmes 9dom, encodi b-matériel H.264 f-blastou:

ffmpeg -i input.mov -c:v h264_videotoolbox -b:v 6000k -c:a aac -b:a 192k output.mp4

5ater H.264 a9al efficacité f-compression b-50% men HEVC, ki t7ott bitrate a3la chwaya 6,000 kbps (-b:v 6000k) tadhmen nafs el woudhou7.

Kifech t5arrej wella ta7ra9 sous-titres b-FFmpeg?

Gestion sous-titres wa7da men akther isti3malet FFmpeg, sawa2 t7eb t5arrej piste texte lel tarjama wella ta7ra9 sous-titres mstylin f-taswira lel réseaux sociaux.

Ta5rij piste sous-titres men fichier MKV:

ffmpeg -i input.mkv -map 0:s:0 output.srt

Tafsir el options:

  • -i input.mkv: El fichier el asli elli fih sous-titres intégrés.
  • -map 0:s:0: Ye5tar awwel flux sous-titres (s:0) men awwel fichier entrée (0). Ken film fih barcha pistes (Anglais, Français, Espagnol), tnajem te5tar el thenia b--map 0:s:1.
  • output.srt: Y9oul l-FFmpeg ybadel w ysajjel flux sous-titres f-format texte SubRip (.srt). Ken sous-titres el asliyin fihom styles motaqqadmin (kima fansubs anime), esta3mel -c:s copy output.ass bech t7afedh 3al typographie.

7ar9 sous-titres da5el vidéo (hardsubbing):

Ken bech tuploadi clip l-plateforme ma ted3amch pistes sous-titres séparées, tnajem ta7ra9 el ktiba direct f-images el vidéo:

ffmpeg -i input.mp4 -vf "subtitles=subs.srt" -c:v hevc_videotoolbox -b:v 4000k -tag:v hvc1 -c:a copy output.mp4

Tafsir el options:

  • -vf "subtitles=subs.srt": Ychaghgel filtre vidéo FFmpeg bech yersom el texte men subs.srt fou9 images el vidéo b-librairie typographie libass.
  • -c:v hevc_videotoolbox -b:v 4000k -tag:v hvc1: 7ar9 sous-titres ybadel données el pixels, donc flux el vidéo lezmou yet3awed yetencoda. Isti3mal accélération matérielle VideoToolbox y5alli el ré-encodage ykammel f-thweni f-blast d9aye9.
  • -c:a copy: Y7afedh 3la piste el sout el asliya men ghir récompression.

Chnowa ta3mel tawwa

5alli el commandes hedhom 9rab lik kol ma test7a9 t7adher fichiers l-telephonet, tna77i sout l-sam3 offline, wella tsalla7 conteneurs mouch compatibles. Ken mazelt ma 7attitech FFmpeg f-terminal macOS, tebba3 el guide mte3na kifech t’installi FFmpeg 3al Mac.

Ken hadfek to93od w tetfarrej f-collection aflamek, ma test7a9ech tdhayye3 wa9t tekteb f-terminal. Nazzel MacLC l-Apple Silicon, 7ott fichiers MKV, WebM, wella MOV direct fel lecteur, w estamta3 b-lecture matériel fawriya m3a da3m kamel l-sous-titres.

As2ela yet3awdou

3lech remuxing MKV l-MP4 sari3 barcha f-FFmpeg?

Remuxing b--c copy y3awed ynaddhem el conteneur 7awl flux vidéo w audio mawjoudin kahaw. 5ater FFmpeg ma ydécompresich w ma y3awedch yencodi el pixels, el 3amaliya temchi b-sor3at ed-disque f-2 l-5 thweni.

3lech el vidéo el ma9sousa mte3i fiha image wa9fa fel bideya?

Ki t9oss vidéo men ghir ré-encodage b--c copy, FFmpeg lezmou yebda el fichier el jdid 3la keyframe (I-frame). Ken el wa9t elli e5tartou yti7 bin keyframes, el vidéo to93od wa9fa 7atta youssel awwel keyframe.

Chnowa ta3mel option -tag:v hvc1 f-FFmpeg?

Applications Apple kima QuickTime Player, Safari, w Apple TV yotlbou flux HEVC da5el MP4 ykoun 3andhom tag hvc1. Men ghir -tag:v hvc1, QuickTime ywarri écran ak7al wella yorfdh y7ell el fichier.

Kifech nthabbet ken el Mac mte3i yesta3mel accélération matérielle f-FFmpeg?

Executi ffmpeg -encoders fel Terminal w lawej 3la h264_videotoolbox w hevc_videotoolbox. Kenhom mawjoudin, FFmpeg yesta3mel Media Engine matériel mta3 Apple Silicon.

Before you download

MacLC is free. If it is useful to you, a gift helps it skip “Open Anyway” and funds the next release.