LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Help with FFMPEG - make smaller files from big ones (https://www.linuxquestions.org/questions/linux-software-2/help-with-ffmpeg-make-smaller-files-from-big-ones-4175558540/)

acacius 11-10-2015 08:02 PM

Help with FFMPEG - make smaller files from big ones
 
Let's say I have a movie file which is 6 hours long - is there any way to make it into twelve 30-minute MP3 files with FFMPEG?

I tried:

ffmpeg -i input.mp4 -codec copy -map 0 -f segment -segment_time 1800 output%03d.mp3

The error message came:

ffmpeg version 1.0.10 Copyright (c) 2000-2014 the FFmpeg developers
built on Jul 25 2014 07:41:31 with gcc 4.7 (Debian 4.7.2-5)
configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/i386-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libfdk-aac --enable-libdc1394 --disable-altivec --disab libavutil 51. 73.101 / 51. 73.101
libavcodec 54. 59.100 / 54. 59.100
libavformat 54. 29.104 / 54. 29.104
libavdevice 54. 2.101 / 54. 2.101
libavfilter 3. 17.100 / 3. 17.100
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2015-09-17 09:20:49
Duration: 00:12:31.76, start: 0.000000, bitrate: 328 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 230 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 95 kb/s
Metadata:
creation_time : 2015-09-17 09:20:51
handler_name : IsoMedia File Produced by Google, 5-11-2011
[mp3 @ 0x8b11960] Invalid audio stream. Exactly one MP3 audio stream is required.
Output #0, segment, to 'output%03d.mp3':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
encoder : Lavf54.29.104
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=2-31, 230 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, 95 kb/s
Metadata:
creation_time : 2015-09-17 09:20:51
handler_name : IsoMedia File Produced by Google, 5-11-2011
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

Keith Hedger 11-10-2015 08:44 PM

if you convert to mpeg you should just be able to use normal file tools like dd to chop it into segments, at least I assume you can as you can just concat to mpeg files and they will play ok as one big file

bat999 11-11-2015 02:19 PM

Quote:

Originally Posted by acacius (Post 5447836)
Let's say I have a movie file which is 6 hours long - is there any way to make it into twelve 30-minute MP3 files with FFMPEG?

Hi
This command works for me with FFmpeg version git-2015-10-28.
Code:

ffmpeg -i filename.mp4 -f segment -segment_time 1800 -vn -c:a libmp3lame -b:a 128k -ac 2 -ar 44100 filename_03d.mp3
The result is like this
filename_000.mp3
filename_001.mp3
filename_002.mp3
etc

example
Code:

@xubuntu:~$ mediainfo filename_000.mp3
General
Complete name        : filename_000.mp3
Format                : MPEG Audio
File size            : 27.5 MiB
Duration              : 30mn 0s
Overall bit rate mode : Constant
Overall bit rate      : 128 Kbps
Writing library      : LAME3.99.5
major_brand          : mp42
minor_version        : 0
compatible_brands    : isommp42

Audio
Format                : MPEG Audio
Format version        : Version 1
Format profile        : Layer 3
Mode                  : Joint stereo
Duration              : 30mn 4s
Bit rate mode        : Constant
Bit rate              : 128 Kbps
Channel(s)            : 2 channels
Sampling rate        : 44.1 KHz
Compression mode      : Lossy
Stream size          : 27.5 MiB (100)
Writing library      : LAME3.99.5

My filename.mp4 has one video track and one audio track.
You might need to use the "map" option if your file has more than one audio track.

acacius 11-11-2015 08:09 PM

Quote:

Originally Posted by bat999 (Post 5448231)
Hi
This command works for me with FFmpeg version git-2015-10-28.
Code:

ffmpeg -i filename.mp4 -f segment -segment_time 1800 -vn -c:a libmp3lame -b:a 128k -ac 2 -ar 44100 filename_03d.mp3
The result is like this
filename_000.mp3
filename_001.mp3
filename_002.mp3
etc

example
Code:

@xubuntu:~$ mediainfo filename_000.mp3
General
Complete name        : filename_000.mp3
Format                : MPEG Audio
File size            : 27.5 MiB
Duration              : 30mn 0s
Overall bit rate mode : Constant
Overall bit rate      : 128 Kbps
Writing library      : LAME3.99.5
major_brand          : mp42
minor_version        : 0
compatible_brands    : isommp42

Audio
Format                : MPEG Audio
Format version        : Version 1
Format profile        : Layer 3
Mode                  : Joint stereo
Duration              : 30mn 4s
Bit rate mode        : Constant
Bit rate              : 128 Kbps
Channel(s)            : 2 channels
Sampling rate        : 44.1 KHz
Compression mode      : Lossy
Stream size          : 27.5 MiB (100)
Writing library      : LAME3.99.5

My filename.mp4 has one video track and one audio track.
You might need to use the "map" option if your file has more than one audio track.

It worked!


All times are GMT -5. The time now is 08:53 PM.