LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-10-2015, 08:02 PM   #1
acacius
LQ Newbie
 
Registered: Jun 2015
Posts: 7

Rep: Reputation: Disabled
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
 
Old 11-10-2015, 08:44 PM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 2,567

Rep: Reputation: 647Reputation: 647Reputation: 647Reputation: 647Reputation: 647Reputation: 647
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
 
Old 11-11-2015, 02:19 PM   #3
bat999
LQ Newbie
 
Registered: Sep 2013
Location: UK
Distribution: Linux Mint 18 "Sarah" - Xfce (64-bit)
Posts: 29

Rep: Reputation: Disabled
Quote:
Originally Posted by acacius View Post
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.

Last edited by bat999; 11-11-2015 at 02:31 PM.
 
1 members found this post helpful.
Old 11-11-2015, 08:09 PM   #4
acacius
LQ Newbie
 
Registered: Jun 2015
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bat999 View Post
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!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create two smaller RPM packages instead one big? piooreq Linux - General 4 06-01-2011 08:26 AM
Compress and split a big sized file into smaller files hicham007 Programming 3 07-28-2005 08:56 PM
splitting one big file to smaller parts? minm Linux - Newbie 4 12-26-2004 03:05 AM
a good program for choping big mp3's into smaller ones? poiuytrewq Linux - Software 1 10-28-2004 06:06 PM
The big question, and a few smaller ones... redkazan Linux - Newbie 7 01-07-2004 02:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration