Is there a way to get exactly 1 second clip using ffmpeg with the AAC codec in AAC

If I have a .mp4 file with a video stream and an audio stream. I execute this command:

ffmpeg -i input.mp4 -ss 00:00:14.000 -t 00:00:01.000 -vn -c:a libfaac audio.m4a 

Result: Duration: 00: 00: 01.02, start: 0.021179. I want the start time to start at 0, so I tried it using:

 ffmpeg -i audio.m4a -ss 00:00:00.000 -t 00:00:01.000 -c:a libfaac audio2.m4a 

The result of this command has a duration of: 00: 00: 01.02, beginning: 0.000000. Is there a way to get exactly 1 second as an end result with 0 value to start with?

In previous attempts, I used the -map 0: 1 -ab 128k -ar 44100 flags, but it gives the same results.

I can provide full output from ffmpeg if necessary.

Thanks.

+6
source share
1 answer

I fixed this by selecting frames instead

 $ ffmpeg -i input.mp4 -ss 14 -frames 46 -vn pass-1.m4a $ ffmpeg -i pass-1.m4a -c copy audio.m4a 

Result

  $ ffmpeg -i audio.m4a
 Input # 0, mov, mp4, m4a, 3gp, 3g2, mj2, from 'audio.m4a':
   Metadata:
     major_brand: M4A
     minor_version: 512
     compatible_brands: isomiso2
     encoder: Lavf55.1.100
   Duration: 00: 00: 01.00, start: 0.000000, bitrate: 135 kb / s
     Stream # 0: 0 (und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp,
                              125 kb / s
     Metadata:
       handler_name: SoundHandler
0
source

All Articles