LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   which software to convert video files then join them together? (https://www.linuxquestions.org/questions/linux-software-2/which-software-to-convert-video-files-then-join-them-together-4175494914/)

Shadowmeph 02-14-2014 10:26 AM

which software to convert video files then join them together?
 
I have a few video file some mp4,mkv avi , I thuink I need tio cionvert them all into the same file format, I guess I need a program that canformat then tio the same type and then join them togehter any suggestions on which program or programs that can do this?

rtmistler 02-14-2014 10:54 AM

I'm sure there are better ways, but you can use either ffmpeg or avconv to convert these to MPEG and then copy then together into one file.

Shadowmeph 02-14-2014 11:52 AM

ok ty I will check those out :)

honeybadger 02-14-2014 12:23 PM

I once had excellent results for joining video files using cat command.

Shadowmeph 02-14-2014 12:36 PM

I tryied the above but it doesn't seem to find the audio in the file, I then found and installed hand vbreak which works but now I am not sure what to use to merge or join the files together

schneidz 02-14-2014 12:40 PM

this is what i do:
Code:

mencoder -oac copy -ovc copy -o tmp.avi breaking-bad-35-thirty-eight-snub.mkv breaking-bad-45-end-times.mkv
/usr/bin/mkvmerge  --title "$dvd-$title-ac3" --track-name 0:"$dvd-$title-ac3" --language 1:en --track-name 1:"AC3 5.1" tmp.avi -o whatever-floats-your-boat.mkv

mencoder will take any type of file/container/codec/format it can understand and spit it out as avi but it takes the first input file's resolution and frame rate for the output.

rtmistler 02-14-2014 12:49 PM

Pretty sure I used lxsplit. I named one of the files a.mpg.001 and the other one a.mpg.002 then used lxsplit with the -j option. When I said "copy" before I was thinking of cp; however I'm realizing that DOS copy would allow a+b+c to concatenate files, Linux cp does not. The cat idea would work too if you did it correctly.

Code:

cat a.mpg > c.mpg
cat b.mpg >> c.mpg

Note that the second one concatenates to the end of the existing file, the first one creates the new file, that's the difference between the single and double >

Shadowmeph 02-14-2014 01:14 PM

Quote:

Originally Posted by schneidz (Post 5117777)
this is what i do:
Code:

mencoder -oac copy -ovc copy -o tmp.avi breaking-bad-35-thirty-eight-snub.mkv breaking-bad-45-end-times.mkv
/usr/bin/mkvmerge  --title "$dvd-$title-ac3" --track-name 0:"$dvd-$title-ac3" --language 1:en --track-name 1:"AC3 5.1" tmp.avi -o whatever-floats-your-boat.mkv

mencoder will take any type of file/container/codec/format it can understand and spit it out as avi but it takes the first input file's resolution for the output.

ok so I need to install mencoder then after the install I open terminal to where ever the files are mencoder -oac copy ( I think means load mencoder and copy the audio which woukld make the -ovc video) -0 ( I am nopt sure twat that does) but this tmp.avi I think means the file output and then the name of the files , so in this like if I wanted to merge or add 4 files I need to type in the names of the four files and file types like ex1.mkv ek1.mp4 ex2.mkv ea1.avi
the problem I see if that I need to first cionvert them into the same file type say a mp4 the do the above?

rtmistler 02-14-2014 01:30 PM

I would make them the same format. Admittedly the few times I did it; it was to take a full video we made of either a class or a technical discussion. I used tools (like ffmpeg) to create smaller videos from the main one, they were not all encompassing; the idea was to take a portion of the discussion which was considered relevant and save that, do that for all relevant portions, then create one video which was continuous, but smaller, shorter than the original.

The other point there is that there were no coding differences, no differences in frames per second, and no differences in size of the frames. I'm not sure what would happen if you had totally different video formats, in resolution as well as size and encoding.

I'd probably lean towards using the lowest common format. I.e. if you had one at 640x480 and another at a higher resolution, I'd try to code the better one down to the lower resolution before I combined them. That concept stinks, but I'm not sure you can just mix different resolutions and have it all work cleanly.

Worth a try though. What you can do is take one file and grab a short chunk of it. Same for the next file. See what happens if you combine different resolutions, or if you try to take a lower resolution file and make it higher resolution, see how bad it ends up looking. Otherwise lower the resolution of the better one.

Sorry, I don't know the syntax of mencoder, seems to be similar to ffmpeg, though. For instance to grab a 2 second chunk of some video using ffmpeg, I'd do the following:
Code:

ffmpeg -i input.mpg -t 0:00:02 output.mpg
Or for instance to grab 2 seconds of video but starting at timestamp 1m, 34 seconds:
Code:

ffmpeg -i input.mpg -ss 0:01:34 -t 0:00:02 output.mpg

harryhaller 02-14-2014 01:35 PM

Quote:

Originally Posted by Shadowmeph (Post 5117796)
ok so I need to install mencoder then

If you have mplayer, you should have mencoder - they even have the same man page - and do read it and see how powerful it is :)

Shadowmeph 02-14-2014 01:55 PM

dam wasted my time transcoding the files to m4v only to discover that transcoder doesn't work with those file types lol

Shadowmeph 02-14-2014 02:19 PM

ok so I actually was able to merge 2 files together they were both .m4v files each was under 300mb but the output of the avi file was over 1.5 gb which is almsot twice the size I was hoping for. I used mencoder

schneidz 02-14-2014 02:42 PM

thats weird, can you show output like below:
Code:

[schneidz@mom breaking-bad]$ ll breaking-bad-35-thirty-eight-snub.mkv breaking-bad-45-end-times.mkv
-rwxrwxr-x. 1 schneidz schneidz 495913639 Dec 11 20:15 breaking-bad-35-thirty-eight-snub.mkv
-rwxrwxr-x. 1 schneidz schneidz 495928472 Dec 11 20:23 breaking-bad-45-end-times.mkv
[schneidz@mom breaking-bad]$ file breaking-bad-35-thirty-eight-snub.mkv breaking-bad-45-end-times.mkv
breaking-bad-35-thirty-eight-snub.mkv: Matroska data
breaking-bad-45-end-times.mkv:        Matroska data
[schneidz@mom breaking-bad]$ mencoder -oac copy -ovc copy -o tmp.mkv breaking-bad-35-thirty-eight-snub.mkv breaking-bad-45-end-times.mkv
...
[schneidz@mom breaking-bad]$ ll tmp.mkv
-rw-rw-r--. 1 schneidz schneidz 915222606 Feb 14 15:40 tmp.mkv
[schneidz@mom breaking-bad]$ file tmp.mkv
tmp.mkv: RIFF (little-endian) data, AVI, 720 x 480, ~30 fps, video:, audio: Dolby AC3 (6 channels, 48000 Hz)


Shadowmeph 02-14-2014 03:46 PM

Quote:

Originally Posted by schneidz (Post 5117859)
thats weird, can you show output like below:
Code:

[schneidz@mom breaking-bad]$ ll breaking-bad-35-thirty-eight-snub.mkv breaking-bad-45-end-times.mkv
-rwxrwxr-x. 1 schneidz schneidz 495913639 Dec 11 20:15 breaking-bad-35-thirty-eight-snub.mkv
-rwxrwxr-x. 1 schneidz schneidz 495928472 Dec 11 20:23 breaking-bad-45-end-times.mkv
[schneidz@mom breaking-bad]$ file breaking-bad-35-thirty-eight-snub.mkv breaking-bad-45-end-times.mkv
breaking-bad-35-thirty-eight-snub.mkv: Matroska data
breaking-bad-45-end-times.mkv:        Matroska data
[schneidz@mom breaking-bad]$ mencoder -oac copy -ovc copy -o tmp.mkv breaking-bad-35-thirty-eight-snub.mkv breaking-bad-45-end-times.mkv
...
[schneidz@mom breaking-bad]$ ll tmp.mkv
-rw-rw-r--. 1 schneidz schneidz 915222606 Feb 14 15:40 tmp.mkv
[schneidz@mom breaking-bad]$ file tmp.mkv
tmp.mkv: RIFF (little-endian) data, AVI, 720 x 480, ~30 fps, video:, audio: Dolby AC3 (6 channels, 48000 Hz)


I am currently trying winFF .
where do I find the output files from menocoder?

Shadowmeph 02-14-2014 04:26 PM

Ok I am just going to paste the most of the output.

Code:

mediapc@mediapc-desktop ~/TVVideos/WPC $ mencoder -oac copy -ovc copy -o WPC.56.1-2.avi WPC.56.S02E01.m4v WPC.56.S02E02.
MEncoder svn r34540 (Ubuntu), built with gcc-4.7 (C) 2000-2012 MPlayer Team
success: format: 0  data: 0x0 - 0x11b29900
libavformat version 53.21.1 (external)
Mismatching header version 53.19.0
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang und
VIDEO:  [H264]  852x480  24bpp  25.000 fps  754.6 kbps (92.1 kbyte/s)
[V] filefmt:44  fourcc:0x34363248  size:852x480  fps:25.000  ftime:=0.0400
videocodec: framecopy (852x480 24bpp fourcc=34363248)
Audio format 0x4134504d is incompatible with '-oac copy', please try '-oac pcm' instead or use '-fafmttag' to override it.

Exiting...
mediapc@mediapc-desktop ~/TVVideos/WPC $ mencoder -oac pcm -ovc copy -o WPC.56.1-2.avi WPC.56.S02E01.m4v WPC.56.S02E02.m4v
MEncoder svn r34540 (Ubuntu), built with gcc-4.7 (C) 2000-2012 MPlayer Team
success: format: 0  data: 0x0 - 0x11b29900
libavformat version 53.21.1 (external)
Mismatching header version 53.19.0
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang und
VIDEO:  [H264]  852x480  24bpp  25.000 fps  754.6 kbps (92.1 kbyte/s)
[V] filefmt:44  fourcc:0x34363248  size:852x480  fps:25.000  ftime:=0.0400
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
libavcodec version 53.35.0 (external)
Mismatching header version 53.32.2
AUDIO: 48000 Hz, 2 ch, s16le, 159.9 kbit/10.41% (ratio: 19990->192000)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
videocodec: framecopy (852x480 24bpp fourcc=34363248)
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Pos:2584.8s  64621f (99%) 4686.42fps Trem:  0min 709mb  A-V:0.026 [754:1536]
success: format: 0  data: 0x0 - 0x1123fa5d
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang und
VIDEO:  [H264]  852x480  24bpp  25.000 fps  693.9 kbps (84.7 kbyte/s)
[V] filefmt:44  fourcc:0x34363248  size:852x480  fps:25.000  ftime:=0.0400
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, s16le, 160.0 kbit/10.41% (ratio: 19994->192000)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
.
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.

Video stream:  723.698 kbit/s  (90462 B/s)  size: 476319718 bytes  5265.400 secs  131635 frames

Audio stream: 1536.000 kbit/s  (192000 B/s)  size: 1010974720 bytes  5265.493 secs
mediapc@mediapc-desktop ~/TVVideos/WPC $

What did I do wrong?

schneidz 02-14-2014 07:59 PM

that sux... it seems like mencoder is unable to output aac audio. i saw this on a google search result:
Code:

mencoder -oac faac -faacopts quality=800 -ovc copy -o WPC.56.1-2.avi WPC.56.S02E01.m4v WPC.56.S02E02.m4v

Shadow_7 02-14-2014 08:12 PM

If they're all the same resolution and same framerate, you can use avconv or ffmpeg to output rawvideo, then cat the many outputs to one big file (in sequence) and encode that to a single video. All things being equal of course.

Audio may not be as simple as you might need to fudge a bit. 1601.6 samples per frame at 30 fps (30000/1001) at 48kHz. You'll need to account for full audio for all frames, any failure means audio sync issues.

And any variations in frame rate makes things infinitely more complex to travel that very manual road. KDENLive, lives, cinelerra, and many other more GUI orientated methods to "edit" videos to a product. Probably with a significantly smaller learning curve if you have the hardware to handle it. Since they'll do the math for you most times.

harryhaller 02-14-2014 08:52 PM

Quote:

Originally Posted by schneidz (Post 5117970)
that sux... it seems like mencoder is unable to output aac audio. i saw this on a google search result:
Code:

mencoder -oac faac -faacopts quality=800 -ovc copy -o WPC.56.1-2.avi WPC.56.S02E01.m4v WPC.56.S02E02.m4v

Try:

Code:

-oac pcm

Shadowmeph 02-14-2014 09:17 PM

Quote:

Originally Posted by harryhaller (Post 5117979)
Try:

Code:

-oac pcm

that is what I did it orginally and it does work but the size of the avi file is almost twice as large as a avi if I could leave the file mv4 it would not be so large


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