Hello,
As explained here, I had an issue editing an MPG file that was actually several MPG files joined into one, due to the 2GB file limit imposed by FAT32 in my camcorder.
This is the first time I was struggling, but in case the issue comes up again, I wanted to ask: Is there a more reliable way to join MPG files than either of the following?
Thank you.Code:copy /b file1.mpg+file2.mpg merged.mpg ffmpeg -i "concat:file1.mpg|file2.mpg" -c copy -target pal-dvd merged.mpg
FWIW, here's what MediaInfo reports about one of the source files:
Code:General Complete name : C:\file1.mpg Format : MPEG-PS File size : 1.98 GiB Duration : 29 min 57 s Overall bit rate mode : Variable Overall bit rate : 9 446 kb/s Video ID : 224 (0xE0) Format : MPEG Video Format version : Version 2 Format profile : Main@Main Format settings : CustomMatrix / BVOP Format settings, BVOP : Yes Format settings, Matrix : Custom Format settings, GOP : M=3, N=12 Format settings, picture structure : Frame Duration : 29 min 57 s Bit rate mode : Variable Bit rate : 8 810 kb/s Maximum bit rate : 9 100 kb/s Width : 720 pixels Height : 576 pixels Display aspect ratio : 16:9 Frame rate : 25.000 FPS Standard : PAL Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Interlaced Scan order : Top Field First Compression mode : Lossy Bits/(Pixel*Frame) : 0.850 Time code of first frame : 00:00:00:00 Time code source : Group of pictures header GOP, Open/Closed : Closed Stream size : 1.84 GiB (93%) Audio ID : 189 (0xBD)-128 (0x80) Format : AC-3 Format/Info : Audio Coding 3 Commercial name : Dolby Digital Muxing mode : DVD-Video Duration : 29 min 56 s Bit rate mode : Constant Bit rate : 448 kb/s Channel(s) : 6 channels Channel layout : L R C LFE Ls Rs Sampling rate : 48.0 kHz Frame rate : 31.250 FPS (1536 SPF) Compression mode : Lossy Stream size : 96.0 MiB (5%) Service kind : Complete Main
+ Reply to Thread
Results 1 to 20 of 20
-
-
You should almost never use COPY/B or "ffmpeg concat" like that to append A/V files. About the only time that works is when a large file was blindly split into smaller segments. In cases like that the individual segments usually won't play because parts of the A/V container structure are in different segments.
You should usually use something like:
Code:ffmpeg -y -safe 0 -f concat -i list.txt -c copy output.mp4
Code:file 'file1.mpg' file 'file2.mpg'
Last edited by jagabo; 26th Sep 2019 at 09:02.
-
Thanks.
I did try the first method before trying the second one, but for some reason, the file was crap (1,3GB instead of ~7GB, and after about 30mn, the audio turned into garbage.)
I just gave method#1 another try, and, like before, 1) a lof ot scary error messages scrolled by and 2) the file was again about 1,3GB. -
If both files have the same specifications you could append one the other using MKVToolNix - the output would be a MKV file with no re-encoding or loss of quality.
SONY 75" Full array 200Hz LED TV, Yamaha A1070 amp, Zidoo UHD3000, BeyonWiz PVR V2 (Enigma2 clone), Chromecast, Windows 11 Professional, QNAP NAS TS851 -
Code:
C:\>mkvmerge -o merged.mkv M2U00427.MPG M2U00428.MPG M2U00429.MPG
In case I need to open an MKV file in Vegas Movie Studio, I'll just convert it to MPEG2 using eg. EaseFab Video Converter.
Thank you very much.Last edited by yetanotherlogin; 27th Sep 2019 at 05:51.
-
VideoRedo has a Joiner that I sometimes use, but it's not free. You can append an additional file to the current location in Virtualdub/2 but not sure how well it works (if at all) with MPeg2 files? I think you can do something similar with AviDemux as well - again, not sure how well it works (if at all).
-
I'll report back the next time I need to edit a video recorded with my camcorder.
-
Just a thought, does your camcorder actually require the memory card to be formatted as FAT32? Might it accept one formatted as NTFS or exFAT? (I'm assuming that it's recording to memory card rather than internal hdd?)
-
I haven't checked since the Sony HDR-PJ30 camcorder can record several hours on its 32GB internal memory.
Apparently, that camcorder can use up to "SDXC UHS-I Memory Card Class 10 64 GB SF-64UX" card.
https://www.sony-mea.com/support/resources/en_AP/html/Compatibility/SDCard/handycam.htm
Could it then be formated in either NTFS or ex-FAT?
--
Edit: I had a 32GB SDCard lying around, so gave it a try. The camcorder also formats it in FAT32.Last edited by yetanotherlogin; 27th Sep 2019 at 10:11.
-
What camera are you using? The "right" way to join the files may be by using the folder structure and intended software provided by the manufacturer. It appears you are talking about spanned clips?
-
FAT32 is probably the most compatible format but it might still be worth trying to format the card in your PC/laptop as NTFS or exFAT and then see if your camcorder can see and use it.
-
Except best practices is to always let the camera do the formatting.
If the cam is the thing that broke these up, they should all be self-contained pieces that should be immediately appendable in most NLEs, incl. Avidemux.
However, if it uses a cliplist/playlist like AVCHD does, you shouldn't have to do anything like that. All you do is load the folder (structure) into the NLE (or in a few editors, the playlist) and it will automatically append properly. In fact, this is the recommended method for AVCHD, so maybe it is for your cam as well.
Scott -
It supports both AVCHD and MPEG-2, and am using the latter to record longer.
https://www.cnet.com/g00/products/sony-hdr-pj/ -
What Scott said. Plus you should be able to transfer spanned clips from your camcorder as single clips by using the USB out on your camera.
-
It supports both AVCHD and MPEG-2, and am using the latter to record longer.
use avchd , highest bitrate, frame rate (50fps if in Europe). Is there extra SD card slot? Look in manual how to import it to PC, there might be metadata with it, in other files. Then loading videos into Vegas should be not a problem. -
You should almost never use COPY/B or "ffmpeg concat" like that to append A/V files. About the only time that works is when a large file was blindly split into smaller segments. In cases like that the individual segments usually won't play because parts of the A/V container structure are in different segments.
You should usually use something like:
ffmpeg -y -safe 0 -f concat -i list.txt -c copy output.mp4
where list.txt is a text file containing the list of files to concatenate:
file 'file1.mpg'
file 'file2.mpg'
This way ffmpeg parses the structure of the individual source files and remuxes the data into a new container with a new structure.
What can be done with ffmpeg is first to convert the files to TS format (Transport Stream – as opposed to PS = Program Stream – which is even more “modular” than MPEG and MPEG-like formats – and more versatile as it can contain other types of streams beyond the standard MPEG compatible ones – systematically arranging, as far as I understand, the video and audio streams in small self-contained “packets” which can be read independently, so that even in case of missing packets caused by a failed transmission the playback can continue with as few glitches as possible), and then concatenate the resulting TS file while converting them back to the container of choice, here MPG, with no transcoding involved.
Code:ffmpeg -i "file1.mpg" -c copy "temp1.ts" ffmpeg -i "file2.mpg" -c copy "temp2.ts" ffmpeg -i "concat:temp1.ts|temp2.ts" -c copy "merged.mpg"
Check (ffprobe?) last GOP of first file and first GOP second file.You may try to extract (demux) elementary streams and combine them and later mux into new container...I have no idea how to do this
mplayer "input.mpg" -dumpvideo -dumpfile "input_vid.m2v"
mpleyer "input.mpg" -dumpaudio -dumpfile "input_vid.ac3"
Or with DGIndex (included in MeGUI), which is much more simple to use than ProjectX, and probably more reliable for MPG demuxing than MPlayer (MPlayer usually extracts raw streams which might be missing a valid header to be properly recognized by most players / editors).
It supports both AVCHD and MPEG-2, and am using the latter to record longer. -
Not it is not. Piping (concat protocol) is a blind concatenation of the input files before demuxing. Using the "concat demuxer" parses the contents of each input before concatenating the streams.
https://trac.ffmpeg.org/wiki/Concatenate
Similar Threads
-
How to join AVI files?
By zaerdy in forum EditingReplies: 4Last Post: 17th Dec 2017, 11:42 -
Trying to join .mts files
By imrealdumb in forum EditingReplies: 1Last Post: 1st Aug 2017, 16:35 -
Join MP4 files
By Casterina in forum EditingReplies: 5Last Post: 21st Sep 2016, 10:06 -
How to join files with MKVToolnix
By yaston in forum Video ConversionReplies: 2Last Post: 5th Feb 2016, 07:22 -
how to join files in Avidemux?
By FaisalKhan in forum Newbie / General discussionsReplies: 15Last Post: 19th Jun 2015, 11:29