[FFmpeg-user] How can I get byte-accurate segments?

Grant Curtis codercurtis at gmail.com
Fri Feb 12 18:31:48 CET 2016


Actually, I may have spoken too soon

When I do

ffprobe out0000.sw

I get

[s16le @ 0000029de496df60] Estimating duration from bitrate, this may be
inaccurate
Input #0, s16le, from 'out0000.sw':
  Duration: 00:00:01.81, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_s16le, 44100 Hz, 1 channels, s16, 705 kb/s

So while the file-size is exactly 160kb, the sample rate seems to be higher.

But when I do the command Paul suggested as-is, I get this:

Input #0, wav, from 'out0000.wav':
  Metadata:
    encoder         : Lavf56.40.101
  Duration: 00:00:05.00, bitrate: 256 kb/s
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, 1
channels, s16, 256 kb/s


Here's the output from the .sw command and its output:

ffmpeg -i "[rtmp url]" -map 0:1 -af aresample=16000,asetnsamples=16000 -f
segment -segment_time 5 -segment_format sw out%04d.sw

Metadata:
  presetname            Custom
  creationdate          Fri Feb 12 08:51:55 2016
  videodevice           BisonCam, NB Pro
  framerate             29.97
  width                 640.00
  height                480.00
  videocodecid          avc1
  videodatarate         1000.00
  avclevel              31.00
  avcprofile            66.00
  videokeyframe_frequency4.00
  audiodevice           Microphone (Realtek High Definition Audio)
  audiosamplerate       22050.00
  audiochannels         1.00
  audioinputvolume      75.00
  audiocodecid          .mp3
  audiodatarate         48.00
Input #0, flv, from
'rtmp://MyFMSWorkspace/osc-simple-ingest/cumin/mp4:cumin_1000 live=1':
  Metadata:
    author          :
    copyright       :
    description     :
    keywords        :
    rating          :
    title           :
    presetname      : Custom
    creationdate    : Fri Feb 12 08:51:55 2016
                    :
    videodevice     : BisonCam, NB Pro
    avclevel        : 31
    avcprofile      : 66
    videokeyframe_frequency: 4
    audiodevice     : Microphone (Realtek High Definition Audio)
    audiochannels   : 1
    audioinputvolume: 75
  Duration: N/A, start: 0.000000, bitrate: 1073 kb/s
    Stream #0:0: Video: h264 (Baseline), yuv420p(tv), 640x480 [SAR 1:1 DAR
4:3], 1024 kb/s, 30.30 fps, 30 tbr, 1k tbn, 60 tbc
    Stream #0:1: Audio: mp3, 22050 Hz, mono, s16p, 49 kb/s
Output #0, segment, to 'out%04d.sw':
  Metadata:
    author          :
    copyright       :
    description     :
    keywords        :
    rating          :
    title           :
    presetname      : Custom
    creationdate    : Fri Feb 12 08:51:55 2016
                    :
    videodevice     : BisonCam, NB Pro
    avclevel        : 31
    avcprofile      : 66
    videokeyframe_frequency: 4
    audiodevice     : Microphone (Realtek High Definition Audio)
    audiochannels   : 1
    audioinputvolume: 75
    encoder         : Lavf56.40.101
    Stream #0:0: Audio: pcm_s16le, 16000 Hz, mono, s16, 256 kb/s
    Metadata:
      encoder         : Lavc56.60.100 pcm_s16le
Stream mapping:
  Stream #0:1 -> #0:0 (mp3 (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
size=N/A time=00:00:07.00 bitrate=N/A
video:0kB audio:219kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown


More information about the ffmpeg-user mailing list