Page 1 of 1

Split and join video and audio in command-line

Posted: 17 Jun 2013 17:13
by dasvlc
Well, the first mistake was that I have bought idiotic action camera recorder Tachyon XC HD. This buggy and very low-quality camera makes .MOV files with some strange streams, that almost no software is able to edit. I have lost maybe 30 hours of research how to convert the .MOV files from the camera to something editable.
I am able to convert the .MOV file video track to .MP4 file via VLC player ("keep-original-video-track" option in "video codec" window). I am able to get the audio track from the .MOV file. But I am not able to join video and audio file together. I have maybe 40 of recording so I would like to use command-line.

Can someone advise me how to split original .MOV file to separate video and audio stream, transcode audio (leave video as is) and join it again to different container (MP4). I thing it should be possible to do it in one command line.

The following command is able to change a container to .MP4, but the resulting file kills VLC player and other software is not able to play it:

Code: Select all

"c:\Program Files\VLC\vlc.exe" f:\DCIM\100XCVID\VID_0024.MOV --sout="#standard{access=file,mux=mp4,dst="e:\scratch\vid24.mp4"}"
The following command takes only video track and works fine, but the resulting file is without audio ofcourse:

Code: Select all

"c:\Program Files\VLC\vlc.exe" f:\DCIM\100XCVID\VID_0024.MOV --no-sout-audio --sout="#standard{access=file,mux=mp4,dst="e:\scratch\vid24.mp4"}"
The original file properties in MediaInfo are following:\
General
Complete name : F:\DCIM\100XCVID\VID_0024.MOV
Format : QuickTime
Format/Info : Original Apple specifications
File size : 80.5 MiB
Duration : 1mn 19s
Overall bit rate : 8 475 Kbps
Encoded date : UTC 2013-06-13 12:23:31
Tagged date : UTC 2013-06-13 12:23:31

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Main@L4.0
Format settings, CABAC : Yes
Format settings, ReFrames : 1 frame
Format settings, GOP : M=1, N=5
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1mn 19s
Bit rate : 8 295 Kbps
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 30.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.300
Stream size : 78.7 MiB (98%)
Language : Japanese
Encoded date : UTC 2013-06-13 12:23:31
Tagged date : UTC 2013-06-13 12:23:31

Audio
ID : 2
Format : ADPCM
Codec ID : 2
Duration : 1mn 19s
Source duration : 1mn 20s
Bit rate mode : Constant
Bit rate : 352.8 Kbps
Nominal bit rate : 176 Kbps
Channel(s) : 1 channel
Sampling rate : 44.1 KHz
Stream size : 3.35 MiB (4%)
Source stream size : 3.37 MiB (4%)
Language : Japanese
Encoded date : UTC 2013-06-13 12:23:31
Tagged date : UTC 2013-06-13 12:23:31
mdhd_Duration : 79633
I am using Windows XP with all patches to the date of this submission with VLC player 2.0.7.

Re: Split and join video and audio in command-line

Posted: 17 Jun 2013 17:59
by Jean-Baptiste Kempf
Try to transcode the audio, not discard it.

Re: Split and join video and audio in command-line

Posted: 17 Jun 2013 20:24
by dasvlc
The following command will make a movie file thats kill VLC player when trying to playback:

Code: Select all

"c:\Program Files\VLC\vlc.exe" f:\DCIM\100XCVID\VID_0024.MOV --sout="#transcode{acodec=mp3,ab=128,channels=1,samplerate=44100}:standard{access=file,mux=mp4,dst="e:\scratch\vid24a.mp4"}"
When leaving out "samplerate=44100' it will make correct file even with audio, but Adobe Premiere imports it only without sound. I think that the reason for it is that MP4 container cannot feature MP3 audio.

When I use MP4 AVC audio codec instead of MP3, the VLC Player writes "VLC could not open the encoder".

Code: Select all

"c:\Program Files\VLC\vlc.exe" f:\DCIM\100XCVID\VID_0024.MOV --sout="#transcode{acodec=mp4a,ab=128,channels=1,samplerate=44100}:standard{access=file,mux=mp4,dst="e:\scratch\vid24a.mp4"}"
Do you have idea how to make proper MP4 movie file?

Re: Split and join video and audio in command-line

Posted: 17 Jun 2013 20:58
by Jean-Baptiste Kempf
Try acodec=mpga

Re: Split and join video and audio in command-line

Posted: 17 Jun 2013 21:19
by dasvlc
When using

Code: Select all

"c:\Program Files\VLC\vlc.exe" f:\DCIM\100XCVID\VID_0024.MOV --verbose=2 --file-logging --logfile=vlc-log.txt --sout="#transcode{acodec=mpga,ab=128,channels=1,samplerate=44100}:standard{access=file,mux=mp4,dst="e:\scratch\vid24a.mp4"}"
the VLC Player starts and die immediately producing no file at all. I tried to change the bitrate, number of channels or delete samplerate parameter with no result.

Here is log file generated with verbosity=1
-- logger module started --
main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
mp4 warning: unknown box type alis (incompletely loaded)
mp4 warning: unknown box type cslg (incompletely loaded)
mp4 warning: unknown box type alis (incompletely loaded)
mp4 warning: unknown box type (incompletely loaded)
mp4 warning: unknown box type (incompletely loaded)
mp4 warning: CTTS table
avcodec warning: Physical channel configuration not set : guessing
And the same log with verbosity=2
-- logger module started --
main debug: using interface module "logger"
main debug: TIMER module_need() : 7.104 ms - Total 7.104 ms / 1 intvls (Avg 7.104 ms)
main debug: playmlaiisnt dtehbruega:d sr ecbourirledcitnlgy aarcrtaiyv aotfe d
current - rmain odoetb uPgl:a yaldidsitn
g item `VID_0024.MOV' ( file:///f:/DCIM/100XCVID/VID_002main4 .dMeObVu g):
rebuild done - 0 items, index -1
main debug: Creatimain debug: nlgo oaking for interface module: 1 candidate
n input for 'VID_0024.MOV'
main debug: using interface module "globalhotkeys"
main debug: TIMER module_need() : 3.739 ms - Total 3.739 ms / 1 intvls (Avg 3.739 ms)
main: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
main debug: looking for interface module: 4 candidates
main debug: meta ok for (null), need to fetch art
main debug: looking for meta fetcher module: 1 candidate
lua debug: Trying Lua scripts in C:\Documents and Settings\Placevik\Application Data\vlc\lua\meta\fetcher
lua debug: Trying Lua scripts in c:\Program Files\VLC\lua\meta\fetcher
lua debug: Trying Lua playlist script c:\Program Files\VLC\lua\meta\fetcher\tvrage.luac
main debug: using meta fetcher module "lua"
main debug: TIMER module_need() : 11.355 ms - Total 11.355 ms / 1 intvls (Avg 11.355 ms)
main debug: removing module "lua"
main debug: searching art for VID_0024.MOV
main debug: looking for art finder module: 2 candidates
lua debug: Trying Lua scripts in C:\Documents and Settings\Placevik\Application Data\vlc\lua\meta\art
lua debug: Trying Lua scripts in c:\Program Files\VLC\lua\meta\art
lua debug: Trying Lua playlist script c:\Program Files\VLC\lua\meta\art\00_musicbrainz.luac
lua debug: Trying Lua playlist script c:\Program Files\VLC\lua\meta\art\01_googleimage.luac
lua debug: Trying Lua playlist script c:\Program Files\VLC\lua\meta\art\02_frenchtv.luac
main debug: looking for extension module: 1 candidate
lua debug: Opening Lua Extension module
lua debug: Trying Lua playlist script c:\Program Files\VLC\lua\meta\art\03_lastfm.luac
lua debug: Trying Lua scripts in C:\Documents and Settings\Placevik\Application Data\vlc\lua\extensions
main debug: no art finder module matching "any" could be loaded
lua debug: Trying Lua scripts in c:\Program Files\VLC\lua\extensions
main debug: TIMER module_need() : 25.765 ms - Total 25.765 ms / 1 intvls (Avg 25.765 ms)
main debug: using extension module "lua"
main debug: art not found for VID_0024.MOV
main debug: TIMER module_need() : 13.799 ms - Total 13.799 ms / 1 intvls (Avg 13.799 ms)
main debug: using interface module "qt4"
main debug: TIMER module_need() : 145.381 ms - Total 145.381 ms / 1 intvls (Avg 145.381 ms)
main debug: rebuilding array of current - root Playlist
main debug: rebuild done - 1 items, index -1
main debug: processing request item: null, node: Playlist, skip: 0
main debug: starting playback of the new playlist item
main debug: resyncing on VID_0024.MOV
main debug: VID_0024.MOV is at 0
main debug: creating new input thread
main debug: Creating an input for 'VID_0024.MOV'
main debug: using sout chain=`transcode{acodec=mpga,ab=128,channels=1,samplerate=44100}:standard{access=file,mux=mp4,dst=e:\scratch\letani\vid24a.mp4}'
main debug: stream=`standard'
main debug: looking for sout stream module: 1 candidate
main debug: set config option: sout-standard-access to file
main debug: set config option: sout-standard-mux to mp4
main debug: set config option: sout-standard-dst to e:\scratch\letani\vid24a.mp4
main debug: looking for sout access module: 1 candidate
access_output_file debug: file access output opened (e:\scratch\letani\vid24a.mp4)
main debug: using sout access module "access_output_file"
main debug: TIMER module_need() : 5.911 ms - Total 5.911 ms / 1 intvls (Avg 5.911 ms)
qt4 debug: IM: Setting amna iinn pduetb
ug: looking for sout mux module: 1 candidate
mux_mp4 debug: Mp4 muxer opened
main debug: using sout mux module "mux_mp4"
main debug: TIMER module_need() : 3.854 ms - Total 3.854 ms / 1 intvls (Avg 3.854 ms)
stream_out_standard debug: using `file/mp4://e:\scratch\letani\vid24a.mp4'
main debug: using sout stream module "stream_out_standard"
main debug: TIMER module_need() : 20.784 ms - Total 20.784 ms / 1 intvls (Avg 20.784 ms)
main debug: stream=`transcode'
main debug: looking for sout stream module: 1 candidate
main debug: set config option: sout-transcode-acodec to mpga
main debug: set config option: sout-transcode-ab to 128
main debug: set config option: sout-transcode-channels to 1
main debug: set config option: sout-transcode-samplerate to 44100
stream_out_transcode debug: codec audio=mpga 44100Hz 1 channels 128Kb/s
main debug: using sout stream module "stream_out_transcode"
main debug: TIMER module_need() : 7.890 ms - Total 7.890 ms / 1 intvls (Avg 7.890 ms)
main debug: using timeshift granularity of 50 MiB, in path 'c:\temp'
main debug: `file:///f:/DCIM/100XCVID/VID_0024.MOV' gives access `file' demux `' path `/f:/DCIM/100XCVID/VID_0024.MOV'
main debug: creating demux: access='file' demux='' location='/f:/DCIM/100XCVID/VID_0024.MOV' file='f:\DCIM\100XCVID\VID_0024.MOV'
main debug: looking for access_demux module: 3 candidates
main debug: no access_demux module matching "file" could be loaded
main debug: TIMER module_need() : 2.438 ms - Total 2.438 ms / 1 intvls (Avg 2.438 ms)
main debug: creating access 'file' location='/f:/DCIM/100XCVID/VID_0024.MOV', path='f:\DCIM\100XCVID\VID_0024.MOV'
main debug: looking for access module: 3 candidates
filesystem debug: opening file `f:\DCIM\100XCVID\VID_0024.MOV'
main debug: using access module "filesystem"
main debug: TIMER module_need() : 3.237 ms - Total 3.237 ms / 1 intvls (Avg 3.237 ms)
main debug: Using stream method for AStream*
main debug: starting pre-buffering
main debug: received first data after 0 ms
main debug: pre-buffering done 1024 bytes in 0s - 979 KiB/s
main debug: looking for stream_filter module: 4 candidates
main debug: no stream_filter module matching "any" could be loaded
main debug: TIMER module_need() : 2.199 ms - Total 2.199 ms / 1 intvls (Avg 2.199 ms)
main debug: looking for stream_filter module: 1 candidate
main debug: using stream_filter module "stream_filter_record"
main debug: TIMER module_need() : 1.826 ms - Total 1.826 ms / 1 intvls (Avg 1.826 ms)
main debug: creating demux: access='file' demux='' location='/f:/DCIM/100XCVID/VID_0024.MOV' file='f:\DCIM\100XCVID\VID_0024.MOV'
main debug: looking for demux module: 55 candidates
mp4 warning: unknown box type alis (incompletely loaded)
mp4 warning: unknown box type cslg (incompletely loaded)
mp4 warning: unknown box type alis (incompletely loaded)
mp4 warning: unknown box type (incompletely loaded)
mp4 debug: out of bound child
mp4 warning: unknown box type (incompletely loaded)
mp4 debug: dumping root Box "root"
mp4 debug: | + mdat size 84333578
mp4 debug: | + moov size 31286
mp4 debug: | | + mvhd size 108
mp4 debug: | | + trak size 23754
mp4 debug: | | | + tkhd size 92
mp4 debug: | | | + mdia size 23654
mp4 debug: | | | | + mdhd size 32
mp4 debug: | | | | + hdlr size 33
mp4 debug: | | | | + minf size 23581
mp4 debug: | | | | | + vmhd size 20
mp4 debug: | | | | | + hdlr size 33
mp4 debug: | | | | | + dinf size 36
mp4 debug: | | | | | | + dref size 28
mp4 debug: | | | | | | | + alis size 12
mp4 debug: | | | | | + stbl size 23484
mp4 debug: | | | | | | + stsd size 135
mp4 debug: | | | | | | | + avc1 size 119
mp4 debug: | | | | | | | | + avcC size 33
mp4 debug: | | | | | | + stts size 24
mp4 debug: | | | | | | + stss size 1684
mp4 debug: | | | | | | + stsc size 28
mp4 debug: | | | | | | + stsz size 9576
mp4 debug: | | | | | | + stco size 9572
mp4 debug: | | | | | | + cslg size 32
mp4 debug: | | | | | | + ctts size 24
mp4 debug: | | | | | | + sdtp size 2401
mp4 debug: | | + trak size 7416
mp4 debug: | | | + tkhd size 92
mp4 debug: | | | + mdia size 7316
mp4 debug: | | | | + mdhd size 32
mp4 debug: | | | | + hdlr size 33
mp4 debug: | | | | + minf size 7243
mp4 debug: | | | | | + smhd size 16
mp4 debug: | | | | | + hdlr size 33
mp4 debug: | | | | | + dinf size 36
mp4 debug: | | | | | | + dref size 28
mp4 debug: | | | | | | | + alis size 12
mp4 debug: | | | | | + stbl size 7150
mp4 debug: | | | | | | + stsd size 154
mp4 debug: | | | | | | | + ms size 138
mp4 debug: | | | | | | | | + wave size 86
mp4 debug: | | | | | | | | | + frma size 12
mp4 debug: | | | | | | | | | + ms size 58
mp4 debug: | | | | | | | | | | + size 16711680
mp4 debug: | | | | | | | | | + size 8
mp4 debug: | | | | | | + stts size 24
mp4 debug: | | | | | | + stsc size 28
mp4 debug: | | | | | | + stsz size 20
mp4 debug: | | | | | | + stco size 6916
mp4 debug: file type box missing (assuming ISO Media file)
mp4 debug: found 2 tracks
mp4 debug: track[Id 0x1] read 2389 chunk
mp4 warning: CTTS table
mp4 debug: track[Id 0x1] read 2389 samples length:79s
main debug: selecting program id=0
mp4 debug: adding track[Id 0x1] video (enable) language jpn
mp4 debug: track[Id 0x2] read 1725 chunk
mp4 debug: track[Id 0x2] read 3532800 samples length:79s
mp4 debug: adding track[Id 0x2] audio (enable) language jpn
main debug: using demux module "mp4"
main debug: TIMER module_need() : 55.343 ms - Total 55.343 ms / 1 intvls (Avg 55.343 ms)
main debug: looking for a subtitle file in f:\DCIM\100XCVID\
main debug: looking for packetizer module: 21 candidates
packetizer_h264 debug: found NAL_SPS (sps_id=0)
packetizer_h264 debug: found NAL_PPS (pps_id=0 sps_id=0)
packetizer_h264 debug: avcC length size=4, sps=1, pps=1
main debug: using packetizer module "packetizer_h264"
main debug: TIMER module_need() : 12.551 ms - Total 12.551 ms / 1 intvls (Avg 12.551 ms)
main debug: looking for packetizer module: 21 candidates
main debug: using packetizer module "packetizer_copy"
main debug: TIMER module_need() : 3.736 ms - Total 3.736 ms / 1 intvls (Avg 3.736 ms)
main debug: starting in sync mode
main debug: looking for meta reader module: 2 candidates
lua debug: Trying Lua scripts in C:\Documents and Settings\Placevik\Application Data\vlc\lua\meta\reader
lua debug: Trying Lua scripts in c:\Program Files\VLC\lua\meta\reader
lua debug: Trying Lua playlist script c:\Program Files\VLC\lua\meta\reader\filename.luac
main debug: no meta reader module matching "any" could be loaded
main debug: TIMER module_need() : 7.284 ms - Total 7.284 ms / 1 intvls (Avg 7.284 ms)
main debug: `file:///f:/DCIM/100XCVID/VID_0024.MOV' successfully opened
mp4 debug: track[Id 0x1] using Sync Sample Box (stss)
mp4 debug: stts gives 0 --> 0 (sample number)
mp4 debug: track[Id 0x2] does not provide Sync Sample Box (stss)
main debug: Buffering 0%
main debug: switching to async mode
main debug: adding a new sout input (sout_input:m0a1i0nb 7d0e2b0u)g
: adding a nmeawi ns oduetb uign:p uBtu f(fseoruitn_gi n0p%u
t:02f3b058)
stream_out_transcode debug:m aniont dterbaungs:c oBduifnfge rai nsgt r3e3a%m
(fcc=`h264')
main debug: adding a newm aiinnp udte
bug: Buffering 66%
mux_mp4 debug: adding input
stream_out_transcode debug: creating audio transcoding from fcc=` ms' to fcc=`mpga'
main debug: Buffering 100%
main debug: looking for decoder module: 32 candidates
main debug: Stream buffering done (400 ms in 12 ms)
avcodec debug: libavcodec initialized (interface 0x362901)
avcodec debug: ffmpeg codec (MS ADPCM audio) started
avcodec debug: Using 384000 bytes output buffer
main debug: using decoder module "avcodec"
main debug: TIMER module_need() : 25.187 ms - Total 25.187 ms / 1 intvls (Avg 25.187 ms)
main debug: looking for encoder module: 13 candidates
main debug: using encoder module "twolame"
main debug: TIMER module_need() : 3.519 ms - Total 3.519 ms / 1 intvls (Avg 3.519 ms)
main debug: adding a new input
mux_mp4 debug: adding input
main debug: Decoder buffering done in 29 ms
avcodec warning: Physical channel configuration not set : guessing
Sorry for so long quote, but I didn't find any way how to add attachment.

Re: Split and join video and audio in command-line

Posted: 18 Jun 2013 18:24
by dasvlc
Hey, I am not even able to compress any audio file to MP4A. What's wrong with this command?

Code: Select all

"c:\Program Files\VLC\vlc.exe" e:\scratch\vid24.mp3 -I dummy --verbose=1 --file-logging --logfile=vlc-log.txt --sout="#transcode{acodec=mp4a,ab=128,channels=1}:standard{access=file,mux=mp4,dst="e:\scratch\vid24f.mpa"}" vlc://quit
-- logger module started --
dummy: VLC media player - 2.0.7 Twoflower
dummy: Copyright © 1996-2013 VLC authors and VideoLAN
dummy:
Warning: if you cannot access the GUI anymore, open a command-line window, go to the directory where you installed VLC and run "vlc -I qt"

dummy: using the dummy interface module...
avcodec error: cannot open encoder
main error: Streaming / Transcoding failed
main error: VLC could not open the encoder.
stream_out_transcode error: cannot find audio encoder (module:any fourcc:mp4a). Take a look few lines earlier to see possible reason.
stream_out_transcode error: cannot create audio chain
main error: cannot create packetizer output (mpga)
idummy: command `quit'
-- logger module stopped --
I do faintly remember from some old times that VLC player wasn't able to compress AVC audio (is it same as MP4A?) due to some compilation reasons (licence?). I hope that this case is not that sort of problem...

Re: Split and join video and audio in command-line

Posted: 24 Jun 2013 13:41
by dasvlc
OK. After a couple of tests on another computer I am closing this topic with result, that VLC Player is NOT ABLE to encode MP4A (AAC). I didn't find a reason why.

Re: Split and join video and audio in command-line

Posted: 25 Jun 2013 21:55
by mahal