Merge Audio and Video in Seconds with FFmpeg

Поділитися
Вставка
  • Опубліковано 29 чер 2022
  • FFmpeg is an incredible tool that can seemingly do anything provided you can find the right incantation. I've been using this command a bunch recently and it has saved me a ton of time already.
    The command:
    ffmpeg -i input.mp4 -i input.wav -c:v copy -c:a aac -map 0:v -map 1:a output.mp4
    (Replace input.mp4 with your video file, input.wav with your audio file, and output.mp4 with your desired output file name)
    You can learn more about FFmpeg on their site: ffmpeg.org/
    Let me know if you have any cool FFmpeg commands you run.
    #ffmpeg #videoediting #opensource
  • Наука та технологія

КОМЕНТАРІ • 23

  • @Kodularturkiye
    @Kodularturkiye Рік тому +14

    ffmpeg -i input.mp4 -i input.mp3 -c:v copy -c:a aac -map 0:v -map 1:a output.mp4

  • @sujansinhthakor2314
    @sujansinhthakor2314 Місяць тому

    thanks,i was having trouble using ffmpeg and found out your vid and it worked like a charm

  • @easyvideott7505
    @easyvideott7505 Рік тому +1

    Very nice.... works like a charm :)

  • @LuKoFi
    @LuKoFi 9 місяців тому +1

    thanks, really helpful and well explained

  • @JCNeupert
    @JCNeupert 6 місяців тому

    Thank you very much. I try to encode two stereo streams (front & rear) into one binaural stereo file. The docs tell me to use sofa profiles. I found those, but no docs which one to use. Is there any straight forward command line like (GPT suggests):
    ffmpeg -i front.wav -i rear.wav \
    -filter_complex "[0:a]af=earwax=0.6[b0];[1:a]af=earwax=0.6[b1];[b0][b1]amerge=inputs=2,pan=stereo|FL=FL+0.30*FR|FR=FR+0.30*FL[a]" -map "[a]" -ac 2 -c:a pcm_s16le -y out.wav

  • @bielclashfire
    @bielclashfire 5 місяців тому

    Thanks, dude.

  • @MordorSensei
    @MordorSensei 16 днів тому

    Thanks a lot.

  • @koopdawhoop.
    @koopdawhoop. Рік тому +2

    I used this combined with yt-dlp to download UA-cam videos and oh is it so beautiful

    • @flesz_
      @flesz_ 7 місяців тому

      that's what I am looking for. Did it work without re-encoding ?

    • @Guishan_Lingyou
      @Guishan_Lingyou День тому

      That's the only thing I could see you using this for anytime soon. I haven't tried it yet though.

  • @dan_crim
    @dan_crim Рік тому +1

    i always run `ffmpeg -i input.mkv output.mp4`
    to reduce the video size for yt uploading

  • @SakuraHougetsu28
    @SakuraHougetsu28 11 місяців тому

    Thank you, another question, is there a way to extract audio from a video, loseless with ffmpeg?

    • @dahawk8574
      @dahawk8574 7 місяців тому +2

      SPLIT audio track out from an .mp4 as .m4a without re-encoding:
      --------
      ffmpeg -i input.mp4 -map 0:a:0 -c copy output.m4a
      --------
      I just learned this a few minutes ago from this
      tutorial: v=I0buEOp3l1k&t=3m30s
      I have not tested my tweaks to fit your request, but I expect it should work.

  • @flesz_
    @flesz_ 7 місяців тому

    does it do it without re-encoding?
    I have downloaded youtube video using yt-dlp and have audio and video separately . All it needs is merging together

    • @CODE_IS_EVERYTHING
      @CODE_IS_EVERYTHING  7 місяців тому +1

      Yeah the -c:v copy means it'll just copy the existing without re-encoding. I believe that if you tried to output to a different video format that doesn't support the codec from the original it will automatically try and re-encode. But if you're just doing mp4 -> mp4, or different types but that support the same codec it shouldn't re-encode.

    • @flesz_
      @flesz_ 7 місяців тому

      @@CODE_IS_EVERYTHING thanks

  • @weeb3277
    @weeb3277 3 місяці тому +1

    0:41 your audio file is much bigger than your video file? interesting 🤔

    • @CODE_IS_EVERYTHING
      @CODE_IS_EVERYTHING  3 місяці тому

      Haha whenever I use Adobe audition it balloons my audio file size

  • @christopherrimplington3643
    @christopherrimplington3643 Рік тому

    Gimme the code!!!!!! :)

  • @mothman7786
    @mothman7786 5 місяців тому

    Gotta love simple videos that skip half the information you need to actually complete the process
    And also don't post the command in the description or where to put it :)

    • @CODE_IS_EVERYTHING
      @CODE_IS_EVERYTHING  5 місяців тому

      Haha fair point, thanks for bringing that up, I've added the command to the description.

    • @mothman7786
      @mothman7786 4 місяці тому

      @@CODE_IS_EVERYTHING oh damn, thanks :o
      And sorry about that, I was just trying to find a quick solution to merge my friend's audio layers for a video into a single MP4, but most videos either don't use windows or assume I'm not completely new to using ffmpeg