You are not logged in.
Pages: 1
Hello everybody!
Trying to split one file into parts based on its silence gaps.
Using the '-segment_times' option of 'ffmpeg' with a file named '/media/split' containing the silence gaps times gives an error
ffmpeg -i "/media/input.mp3" -vn -map 0 -f segment -segment_times /media/split "output%03d.mp3"
[segment @ 0x624777763a40] Invalid time duration specification '/media/split' in times list /media/split
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 --
Conversion failed!
However, using the silence gaps times from that file directly works fine
ffmpeg -i "/media/input.mp3" -vn -map 0 -f segment -segment_times 00:23:19,00:33:15 "output%03d.mp3"
ffmpeg version 4.3.5-0+deb11u1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 10 (Debian 10.2.1-6)
configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, mp3, from '/media/input.mp3':
The file looks like this
cat /media/split
00:23:19,00:33:15
Checked the 'ffmpeg' page here
https://ffmpeg.org/ffmpeg-formats.html#segment
and it says
segment_times times
Specify a list of split points. times contains a list of comma separated duration specifications, in increasing order.
How should that file look in order for the command to work?
Thank you!
Last edited by amaro (2023-06-09 23:43:04)
Offline
NI web search result: https://ffmpeg.org/ffmpeg-formats.html# … gment_002c
enjoy.
Online
NI web search result: https://ffmpeg.org/ffmpeg-formats.html# … gment_002c
enjoy.
although I am sure the author(s) of that page believe(s) everything is explained clearly, regarding that issue it seems useless as long as there are only examples of putting the times directly in the command and there are no examples of how the file should look like
Offline
segment_times times
Specify a list of split points. times contains a list of comma separated duration specifications, in increasing order. See also the segment_time option.
It doesn't seem that -segment_times takes a filename argument. You could try -segment_times $(cat /media/split) and see if that works
Offline
segment_times times
Specify a list of split points. times contains a list of comma separated duration specifications, in increasing order. See also the segment_time option.
It doesn't seem that -segment_times takes a filename argument. You could try -segment_times $(cat /media/split) and see if that works
hmm, that didn't occur to me...
here is the output
ffmpeg -i "/media/input.mp3" -vn -map 0 -f segment -segment_times $(cat /media/split) "output%03d.mp3"
Automatic encoder selection failed for output stream #0:0. Default encoder for format segment (codec none) is probably disabled. Please choose an encoder manually.
Error selecting an encoder for stream 0:0
with the '-c copy' option
ffmpeg -i "/media/input.mp3" -vn -c copy -map 0 -f segment -segment_times $(cat /media/split) "output%03d.mp3"
[segment @ 0x586a4de6f240] Invalid time duration specification 'duration' in times list duration
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #1:0 (mjpeg (native) -> png (native))
Stream #0:0 -> #1:1 (mp3 (mp3float) -> mp3 (libmp3lame))
Last message repeated 1 times
adding the '-c copy' option produced one empty text file
ll
total 0
-rw-r--r-- 1 vb vb 0 Jun 11 01:15 output%03d.mp3
interestingly, renaming the '/media/split' file as '.csv' automagically turned it into
cat /media/split.csv
duration 00:23:19, 00:33:15
and the output was
ffmpeg -i "/media/input.mp3" -vn -c copy -map 0 -f segment -segment_times $(cat /media/split.csv) "output%03d.mp3"
[NULL @ 0x650df004aa40] Unable to find a suitable output format for '00:33:15'
00:33:15: Invalid argument
thank you, rbit!
Offline
Pages: 1