Answers.Body: <p>For me the best option is to convert audio files first to lossless .wav, do all things that I need to do and then covert them back to .mp3 or other lossy formats. This is the way that is used in audio editing apps and the most gentle way to work with audio or video files</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-06-16T11:33:29.243Z
Answers.LastActivityDate: 2023-06-16T11:33:29.243Z
Answers.UserDisplayName: Максимилиан В.
Body: <p>I'm trying to add a video and audio fade in and fade out to my video using the <code>fade</code> and <code>afade</code> filters. I'm using the following command:</p>
  
  <pre><code>ffmpeg -i trimmed.mp4 -vf 'fade=in:0:60,fade=out:2940:300' -af 'afade=in:st=0:d=1,afade=out:st=53:d=2' -c:a aac -c:v libx264 -crf 18 -preset veryfast fadeInOut.mp4
  </code></pre>
  
  <p>The resulting audio sound like TV static was overlayed. I've tried specifying audio quality by adding <code>-b:a 128k</code>, but that didn't help either. Any ideas what might be wrong?</p>
  
  <p>Here's the output of <code>ffmpeg -i</code> if that's helpful:</p>
  
  <pre><code>  Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: 
  isomiso2avc1mp41
      encoder         : Lavf58.20.10
  0
    Duration: 00:00:54.54, start: 0.000000
  , bitrate: 9964 kb/s
      Stream #0:
  0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 9589 kb/s, 
  60 fps, 60 tbr, 
  15360 tbn, 
  120 tbc
   (default)
      Metadata:
        handler_name    : VideoHandler
      Stream #0:
  1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 364 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-04-11T12:07:16.597Z
Comments.Text: @PaulB.Mahol Whoops, here it is: `ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 8.2.1 (GCC) 20190212`
Comments.UserDisplayName: NetherGranite
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-04-12T02:51:19.930Z
Comments.Text: @PaulB.Mahol Oh shoot good point, it might be my player's fault. I'm using VLC. I also just tested it with Windows's Photos app, and the same still happens.
Comments.UserDisplayName: NetherGranite
Tags: <ffmpeg><effects><filter>
Title: FFmpeg afade produces horrible audio quality
UserDisplayName: NetherGranite
ThreadText: # FFmpeg afade produces horrible audio quality
  
  (Asked by: username_0 on 2019-04-10)
  
  I'm trying to add a video and audio fade in and fade out to my video using the `fade` and `afade` filters. I'm using the following command:
  
  ```
  ffmpeg -i trimmed.mp4 -vf 'fade=in:0:60,fade=out:2940:300' -af 'afade=in:st=0:d=1,afade=out:st=53:d=2' -c:a aac -c:v libx264 -crf 18 -preset veryfast fadeInOut.mp4
  
  ```
  
  The resulting audio sound like TV static was overlayed. I've tried specifying audio quality by adding `-b:a 128k`, but that didn't help either. Any ideas what might be wrong?
  
  Here's the output of `ffmpeg -i` if that's helpful:
  
  ```
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: 
  isomiso2avc1mp41
      encoder         : Lavf58.20.10
  0
    Duration: 00:00:54.54, start: 0.000000
  , bitrate: 9964 kb/s
      Stream #0:
  0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 9589 kb/s, 
  60 fps, 60 tbr, 
  15360 tbn, 
  120 tbc
   (default)
      Metadata:
        handler_name    : VideoHandler
      Stream #0:
  1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 364 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
  
  ```
  
  **Tags:** ffmpeg, effects, filter
  
  > **Comments:**
  > **username_0**: @PaulB.Mahol Whoops, here it is: `ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 8.2.1 (GCC) 20190212`  
  > **username_0**: @PaulB.Mahol Oh shoot good point, it might be my player's fault. I'm using VLC. I also just tested it with Windows's Photos app, and the same still happens.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-06-16. Score: 0
  
  For me the best option is to convert audio files first to lossless .wav, do all things that I need to do and then covert them back to .mp3 or other lossy formats. This is the way that is used in audio editing apps and the most gentle way to work with audio or video files
  
  
  ---
  
  