6

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

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

The result is Duration: 00:00:01.02, start: 0.021179. I want to make sure the start time begins at 0 so I resample 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 Duration: 00:00:01.02, start: 0.000000. Is there a way to get exactly 1 second as the final result with a 0 value for the start?

I in previous attempts I have used the flags -map 0:1 -ab 128k -ar 44100 but it provides the same results.

I can provide the full output from ffmpeg if need be.

Thanks.

  • A few questions: What is the audio sample rate in the original file? 44100 or 48000 Hz? Is the original audio also AAC? If so, do you mean to do audio transcoding (which will incur generational loss), rather than lossless remuxing? – Multimedia Mike Mar 06 '13 at 01:16
  • Here is the audio stream information: Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 96 kb/s As for your second question, audio transcoding would be fine. Just need to get *exactly* one second duration with a start time of 0 as well. – David Redding Mar 06 '13 at 15:09

1 Answers1

0

I fixed this by selecting the 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
Zombo
  • 1
  • 62
  • 391
  • 407