LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-07-2016, 01:58 PM   #1
rstuff
Member
 
Registered: Jul 2011
Posts: 115

Rep: Reputation: Disabled
Having a problem converting MOV files to MP4 using FFMPEG


I am trying to merge and convert some mov files to an mp4 file. I found a solution at http://potentialinfo.blogspot.com/20...lips-fast.html but I lost the audio in the intermediate file.

This is what I got.

r@r:/media/r/Iomega HDD/Photos/2016-06-04$ ffmpeg -i DSCF0719.MOV -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate4.ts
ffmpeg version 2.1.1 Copyright (c) 2000-2013 the FFmpeg developers
built on Nov 20 2013 08:04:32 with gcc 4.8 (Debian 4.8.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/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-libiec61883 --enable-libfdk-aac --enable-vaapi --enable-libdc1394 --disable-altivec --disable-armv5te --disable-armv6 --disable-vis --shlibdir=/usr/lib/x86_64-linux-gnu
libavutil 52. 48.101 / 52. 48.101
libavcodec 55. 39.101 / 55. 39.101
libavformat 55. 19.104 / 55. 19.104
libavdevice 55. 5.100 / 55. 5.100
libavfilter 3. 90.100 / 3. 90.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'DSCF0719.MOV':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2016-06-03 12:32:07
comment : FUJIFILM DIGITAL CAMERA FinePix HS25EXR
comment-eng : FUJIFILM DIGITAL CAMERA FinePix HS25EXR
Duration: 00:07:52.47, start: 0.000000, bitrate: 14131 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 12577 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 60k tbc (default)
Metadata:
creation_time : 2016-06-03 12:32:07
Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
Metadata:
creation_time : 2016-06-03 12:32:07
Output #0, mpegts, to 'intermediate4.ts':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
comment-eng : FUJIFILM DIGITAL CAMERA FinePix HS25EXR
comment : FUJIFILM DIGITAL CAMERA FinePix HS25EXR
encoder : Lavf55.19.104
Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 1920x1080, q=2-31, 12577 kb/s, 29.97 fps, 90k tbn, 30k tbc (default)
Metadata:
creation_time : 2016-06-03 12:32:07
Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, 1536 kb/s (default)
Metadata:
creation_time : 2016-06-03 12:32:07
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 243 fps=0.0 q=-1.0 size= 15276kB time=00:00:09.00 bitrate=13890.9kbitsframe= 503 fps=502 q=-1.0 size= 31410kB time=00:00:17.01 bitrate=15120.7kbits

The video came out good but I lost the audio. Anyone have a suggestion of how to keep the audio?
 
Old 06-07-2016, 02:48 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 16,990

Rep: Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448
first thing
having a Microsoft "blank space" in the folder name is not a good idea
Code:
:/media/r/Iomega HDD/Photos/2016-06-04
" Iomega HDD "

remove it and re run ffmpeg

Last edited by John VV; 06-07-2016 at 02:49 PM.
 
Old 06-07-2016, 02:57 PM   #3
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 5,388

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
How do you know you lost the audio, you can't hear it?

If you have mplayer installed, could you post output with:

Code:
mplayer -identify -frames 0 intermediate4.ts
Or with other program that shows video file infos
 
Old 06-07-2016, 02:59 PM   #4
notKlaatu
Member
 
Registered: Sep 2010
Location: Wellington, New Zealand
Distribution: Slackware, Fedora
Posts: 921

Rep: Reputation: 585Reputation: 585Reputation: 585Reputation: 585Reputation: 585Reputation: 585
Maybe be more explicit in your command. Something like:

Code:
ffmpeg -i DSCF0719.MOV -acodec copy -vcodec copy -bsf:v h264_mp4toannexb -f mpegts intermediate4.ts
-acodec being "audio codec" and -vcodec being "video codec"

Also, how are you determining that you lost the audio? just because your media player isn't playing it doesn't mean the stream isn't there. Get a proper analysis of your finished file with just this:

Code:
ffmpeg -i intermediate4.ts
or use MediaInfo
 
Old 06-07-2016, 04:17 PM   #5
rstuff
Member
 
Registered: Jul 2011
Posts: 115

Original Poster
Rep: Reputation: Disabled
Mplayer results

The Iomega is an external USB harddrive. I wish I knew how to change it's name but I don't. Besides having a space in it's name it also has a \ after the Iomega which does not show up all the time.

The results of the Mplayer command.

r@r:/media/r/Iomega HDD/Photos/2016-06-04$ mplayer -identify -frames 0 intermediate4.ts
Failed to read /etc/mplayer/mplayer.conf.local: No such file or directory
Warning unknown option include at line 177
MPlayer UNKNOWN-4.8 (C) 2000-2013 MPlayer Team
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing intermediate4.ts.
libavformat version 55.21.100 (internal)
TS file format detected.
PROGRAM_ID=1 (0x01), PMT_PID: 4096(0x1000)
PROGRAM_ID=1 (0x01), PMT_PID: 4096(0x1000)
PROGRAM_ID=1 (0x01), PMT_PID: 4096(0x1000)
.
.
.
VIDEO H264(pid=256) NO AUDIO! (try increasing -tsprobe) NO SUBS (yet)! PROGRAM N. 1
ID_VIDEO_ID=256
.
.
.
PROGRAM_ID=1 (0x01), PMT_PID: 4096(0x1000)
PROGRAM_ID=1 (0x01), PMT_PID: 4096(0x1000)
PROGRAM_ID=1 (0x01), PMT_PID: 4096(0x1000)
FPS not specified in the header or invalid, use the -fps option.
Load subtitles in ./
ID_FILENAME=intermediate4.ts
ID_DEMUXER=mpegts
ID_VIDEO_FORMAT=0x10000005
ID_VIDEO_BITRATE=0
ID_VIDEO_WIDTH=1920
ID_VIDEO_HEIGHT=1088
ID_VIDEO_FPS=0.000
ID_VIDEO_ASPECT=0.0000
PROGRAM_ID=1 (0x01), PMT_PID: 4096(0x1000)
PROGRAM_ID=1 (0x01), PMT_PID: 4096(0x1000)
PROGRAM_ID=1 (0x01), PMT_PID: 4096(0x1000)
PROGRAM_ID=1 (0x01), PMT_PID: 4096(0x1000)
PROGRAM_ID=1 (0x01), PMT_PID: 4096(0x1000)
PROGRAM_ID=1 (0x01), PMT_PID: 4096(0x1000)
PROGRAM_ID=1 (0x01), PMT_PID: 4096(0x1000)
ID_START_TIME=1.43
ID_LENGTH=0.00
ID_SEEKABLE=1
ID_CHAPTERS=0
open: No such file or directory
[MGA] Couldn't open: /dev/mga_vid
open: No such file or directory
[MGA] Couldn't open: /dev/mga_vid
[VO_TDFXFB] This driver only supports the 3Dfx Banshee, Voodoo3 and Voodoo 5.
s3fb: Couldn't map S3 registers: Operation not permitted
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
[vdpau] Error when calling vdp_device_create_x11: 1
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 55.41.100 (internal)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
ID_VIDEO_CODEC=ffh264
Audio: no sound
Starting playback...


Exiting... (End of file)
ID_EXIT=EOF

FFMPEG command results

r@r:/media/r/Iomega HDD/Photos/2016-06-04$ ffmpeg -i intermediate4.ts
ffmpeg version 2.1.1 Copyright (c) 2000-2013 the FFmpeg developers
built on Nov 20 2013 08:04:32 with gcc 4.8 (Debian 4.8.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/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-libiec61883 --enable-libfdk-aac --enable-vaapi --enable-libdc1394 --disable-altivec --disable-armv5te --disable-armv6 --disable-vis --shlibdir=/usr/lib/x86_64-linux-gnu
libavutil 52. 48.101 / 52. 48.101
libavcodec 55. 39.101 / 55. 39.101
libavformat 55. 19.104 / 55. 19.104
libavdevice 55. 5.100 / 55. 5.100
libavfilter 3. 90.100 / 3. 90.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
[mpegts @ 0x23ecb00] probed stream 1 failed
[mpegts @ 0x23ecb00] Could not find codec parameters for stream 1 (Unknown: none ([6][0][0][0] / 0x0006)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'intermediate4.ts':
Duration: 00:01:34.78, start: 1.400000, bitrate: 15201 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080, 29.97 tbr, 90k tbn, 180k tbc
Stream #0:1[0x101](eng): Unknown: none ([6][0][0][0] / 0x0006)
At least one output file must be specified

I don't know what codecs to use to copy mov files to an mp4 file.

Thank you for the help.
 
Old 06-07-2016, 04:40 PM   #6
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,872

Rep: Reputation: Disabled
Please use code tags to post code.

You should not confuse video formats with container formats. Both MOV and MP4 are containers. Both can contain MPEG-4 video. It is possible the video and maybe also audio do not need to be recoded at all, your MOV may be remuxed to MP4.
 
Old 06-07-2016, 05:13 PM   #7
rstuff
Member
 
Registered: Jul 2011
Posts: 115

Original Poster
Rep: Reputation: Disabled
Not hearing audio

You are correct. I am not hearing audio when playing video using Video but I do hear audio when playing original mov video using Video. Sorry I missed the code tags.
 
Old 06-07-2016, 05:34 PM   #8
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,872

Rep: Reputation: Disabled
You should run ffprobe on your MOV file to see what's in it, then you can decide whether you need to remux or recode.
 
Old 06-07-2016, 05:36 PM   #9
erik2282
Member
 
Registered: May 2011
Location: TX
Distribution: Debian, CentOS
Posts: 635

Rep: Reputation: 171Reputation: 171
http://winff.org/html_new/

I use the gui front end for this. Very easy to use.
 
Old 06-08-2016, 12:29 PM   #10
rstuff
Member
 
Registered: Jul 2011
Posts: 115

Original Poster
Rep: Reputation: Disabled
FFPROBE Results

This is the output from FFPROBE.

Code:
r@r:/media/r/Iomega/Videos$ ffprobe JFFS1.MOV
ffprobe version 2.1.1 Copyright (c) 2007-2013 the FFmpeg developers
  built on Nov 20 2013 08:04:32 with gcc 4.8 (Debian 4.8.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/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-libiec61883 --enable-libfdk-aac --enable-vaapi --enable-libdc1394 --disable-altivec --disable-armv5te --disable-armv6 --disable-vis --shlibdir=/usr/lib/x86_64-linux-gnu
  libavutil      52. 48.101 / 52. 48.101
  libavcodec     55. 39.101 / 55. 39.101
  libavformat    55. 19.104 / 55. 19.104
  libavdevice    55.  5.100 / 55.  5.100
  libavfilter     3. 90.100 /  3. 90.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'JFFS1.MOV':
  Metadata:
    major_brand     : qt  
    minor_version   : 0
    compatible_brands: qt  
    creation_time   : 2016-06-03 12:32:07
    comment         : FUJIFILM DIGITAL CAMERA FinePix HS25EXR
    comment-eng     : FUJIFILM DIGITAL CAMERA FinePix HS25EXR
  Duration: 00:07:52.47, start: 0.000000, bitrate: 14131 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 12577 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 60k tbc (default)
    Metadata:
      creation_time   : 2016-06-03 12:32:07
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, 2 channels, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2016-06-03 12:32:07
I did try Winff but I got a lot of error messages about possible bad parameters. I gave Winff 3 source files to merge. They should have all been the same format because they were all taken at the same time back to back without changing any camera setting. I did tell Winff to use the source directory for the output but I was never given an option to name the output file. I was hoping that Winff would merge the 3 files and since they should have all been the same format I was hoping it would have been fast. They were MOV files and I was trying to merge them as MP4 files. I do get confused with the container type and file format especially with MP4. Can anyone tell me the FFMPEG command to merge these three files as an MP4 file? I don't know which codecs to use either.
Thank you.
 
Old 06-08-2016, 12:36 PM   #11
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,872

Rep: Reputation: Disabled
Your MOV has AVC video (this is MPEG-4 video), so do not convert the video. Considering all video codecs are lossy every time you re-code some quality is lost.
Audio you need to convert to AAC.
I recommend Avidemux, it is proven working video editor/transcoder for Linux. I'm a die hard CLI user, but when working with video I'd like to see it.
 
Old 12-01-2016, 03:13 AM   #12
rstuff
Member
 
Registered: Jul 2011
Posts: 115

Original Poster
Rep: Reputation: Disabled
Avidemux Cannot find a demuxer for MOV

When I try using Avidemux it says that it can't find a demuxer. I am using Avidemux 2.6.14. I did find a similar post for MKV files which referenced multimedia/avidemux26 at. Does 2.6.14 include multimedia/avidemux26? Thank you
 
Old 12-01-2016, 03:48 AM   #13
notKlaatu
Member
 
Registered: Sep 2010
Location: Wellington, New Zealand
Distribution: Slackware, Fedora
Posts: 921

Rep: Reputation: 585Reputation: 585Reputation: 585Reputation: 585Reputation: 585Reputation: 585
If I understand your end goal correctly, you're trying to concatenate some files together and produce a single mp4 file.

If this is the case, you should be able to do this:

1. Create an input.list file containing the names of each clip:

Code:
file 'file1.mov'
file 'file2.mov'
file 'file3.mov'
2. Do the concatenation:

Code:
ffmpeg -f concat -i input.list -c copy full.mov
3. Do the conversion. For example:

Code:
ffmpeg -i full.mov -threads 6 -b:v 13000k -acodec libfaac -g 66 full.mp4
Some of those options may need tweaking, but generally that means:
* take full.mov
* convert to ffmpeg mp4
* with a bitrate of 13mbps (your source video is approximately 13mbps, so we're matching)
* with aac sound
* with keyframes every 66 frames

Last edited by notKlaatu; 12-01-2016 at 03:49 AM.
 
Old 12-01-2016, 06:19 PM   #14
rstuff
Member
 
Registered: Jul 2011
Posts: 115

Original Poster
Rep: Reputation: Disabled
Avidemux missing demuxer

Thank you. The concat worked good and produced a 6 Gb file that plays video and sound. The libfaac codec was obsolete and I substituted -strict -2. The conversion is taking hours but appears to be working. How can I use Avidemux without the conversion when it can't find the demuxer?

Last edited by rstuff; 12-01-2016 at 06:30 PM.
 
Old 12-02-2016, 01:23 AM   #15
rstuff
Member
 
Registered: Jul 2011
Posts: 115

Original Poster
Rep: Reputation: Disabled
Used Handbrake for conversion

I ended up using handbrake to convert the combined MOV file to a M4V file. The video played for 1 hour and it took 1 hour to convert from MOV file. The sound and video were also good and it converted the 6.8 Gb MOV file to 2.3 Gb. Thanks to everyone for the help.
 
  


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
[SOLVED] No sound when converting MP4 to WebM while using libvorbis for the audio track in FFmpeg version 2.8.6 MurderousMincePie Linux - Software 6 03-05-2016 12:29 PM
What is the easy way converting .mov file to mp4 satimis Linux - General 6 08-22-2015 12:14 PM
[SOLVED] how do i merge mp4 video files using ffmpeg ? dEnDrOn Linux - Software 2 02-04-2012 07:17 AM
ffmpeg: converting mp4 to webm (vp8) hydraMax Linux - Software 3 09-24-2011 05:52 PM
ffmpeg with -sameq form .mov produces huge files ziocicion Linux - Software 2 06-01-2006 11:07 AM


All times are GMT -5. The time now is 07:33 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