[FFmpeg-user] Why does this command produce different size segments depending on the input?
Grant Curtis
codercurtis at gmail.com
Wed Mar 16 23:15:05 CET 2016
I have this command:
ffmpeg -i "rtmp://url live=1" -map 0:1 -af
aresample=16000,asetnsamples=16000 -f segment -segment_time 5
-segment_format sw out%04d.sw
strips the audio from a live stream and creates 160kb files.
However, when I try the same command on a file, as opposed to a live
stream, I get chunks of variable file sizes.
The file sizes and number of samples in the file (160,000 bytes, 80,000
samples) are very important to the API I'm using.
What changes do I have to make to my command so that it can handle both
rtmp streams and other types of video?
Here is the command and the output when it produces an undesirable file
size:
ffmpeg -i file1.mp4 -map 0:1 -af aresample=16000,asetnsamples=16000 -f
segment -segment_time 5 -segment_format sw out%04d.sw
ffmpeg version 2.8.4 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype
--enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-librtmp
--enable-libschroedinger --enable-libsoxr --enable-libspeex
--enable-libtheora --enable-libtwolame --enable-libvidstab
--enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma
--enable-decklink --enable-zlib
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file1.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2015-04-03 05:49:11
Duration: 00:28:48.80, start: 0.000000, bitrate: 358 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 /
0x31637661), yuv420p, 480x360 [SAR 1:1 DAR 4:3], 260 kb/s, 29.97 fps, 29.97
tbr, 30k tbn, 59.94 tbc (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 95 kb/s (default)
Metadata:
creation_time : 2015-04-03 05:49:18
handler_name : IsoMedia File Produced by Google, 5-11-2011
Output #0, segment, to 'out%04d.sw':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
encoder : Lavf56.40.101
Stream #0:0(und): Audio: pcm_s16le, 16000 Hz, stereo, s16, 512 kb/s
(default)
Metadata:
creation_time : 2015-04-03 05:49:18
handler_name : IsoMedia File Produced by Google, 5-11-2011
encoder : Lavc56.60.100 pcm_s16le
Stream mapping:
Stream #0:1 -> #0:0 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
size=N/A time=00:28:49.00 bitrate=N/A
video:0kB audio:108062kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown
For reference, here is the output when an rtmp stream is used as an input:
ffmpeg -i "rtmp://url live=1" -map 0:1 -af
aresample=16000,asetnsamples=16000 -f segment -segment_time 5
-segment_format sw out%04d.sw
ffmpeg version 2.8.4 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype
--enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-librtmp
--enable-libschroedinger --enable-libsoxr --enable-libspeex
--enable-libtheora --enable-libtwolame --enable-libvidstab
--enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma
--enable-decklink --enable-zlib
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Metadata:
author dsf
presetname Custom
creationdate Wed Mar 16 09:40:36 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:/url live=1':
Metadata:
author : dsf
copyright :
description :
keywords :
rating :
title :
presetname : Custom
creationdate : Wed Mar 16 09:40:36 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.019000, 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 : dsf
copyright :
description :
keywords :
rating :
title :
presetname : Custom
creationdate : Wed Mar 16 09:40:36 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:14.00 bitrate=N/A
video:0kB audio:438kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown
More information about the ffmpeg-user
mailing list