Hello!
I understand that it is impossible to edit metadata of MPG files (i.e. createdate), so I am looking for another way to "upgrade" my MPGs into a newer file format (preferred are formats that work both on Windows and iOS).
What should I do to achieve this goal? Remux/encode/convert my MPG videos into MP4 or MOV and what settings should be used in remuxing/encoding/converting the files? Which action would produce the best result; as close as possible to the original MPG videos?
Many thanks in advance for help and guidance on this matter.
Zarko.
P.S. Here is the mediainfo specification of one of my MPG files:
General
Complete name : E:\Users\Owner\Desktop\test\MOV03521.MPG
Format : MPEG-PS
File size : 25.1 MiB
Duration : 20s 124ms
Overall bit rate mode : Variable
Overall bit rate : 10.5 Mbps
Video
ID : 224 (0xE0)
Format : MPEG Video
Format version : Version 1
Format settings, BVOP : No
Format settings, Matrix : Default
Format settings, GOP : N=1
Duration : 20s 100ms
Bit rate mode : Variable
Bit rate : 10.2 Mbps
Width : 640 pixels
Height : 480 pixels
Display aspect ratio : 4:3
Frame rate : 30.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Compression mode : Lossy
Bits/(Pixel*Frame) : 1.105
Time code of first frame : 00:00:00:00
Time code source : Group of pictures header
GOP, Open/Closed : Closed
Stream size : 24.4 MiB (97%)
Audio
ID : 192 (0xC0)
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 2
Duration : 20s 124ms
Bit rate mode : Constant
Bit rate : 64.0 Kbps
Channel(s) : 1 channel
Sampling rate : 32.0 KHz
Compression mode : Lossy
Stream size : 157 KiB (1%)
+ Reply to Thread
Results 1 to 18 of 18
-
-
No.
"Upgrading" your mpgs to a "newer format" requires re-encoding.
MPEG1 is nearly universally compatible as it is, so I don't understand why you'd want to change ("upgrade") that.
Also, it is NOT impossible to edit metadata in MPEG, but that depends on which metadata you're talking about.
Scott -
Thanks Scott!
If you know how to edit metadata (createdate) in MPG I would kindly ask you to write me how this can be done. I have tried tens of different solutions, but none have worked - it seems as if the MPG documentation does not hold the "createdate" bit of information.
Please see below the difference in metadata for an MPG file and a MP4 file.
Metadata for MPG file:
ExifTool Version Number : 9.79
File Name : MOV03521.MPG
Directory : E:/Users/Owner/Desktop/test
File Size : 25 MB
File Modification Date/Time : 2014:09:23 08:36:56+02:00
File Access Date/Time : 2015:01:10 23:01:21+01:00
File Creation Date/Time : 2015:01:10 23:01:21+01:00
File Permissions : rw-rw-rw-
File Type : MPEG
MIME Type : video/mpeg
MPEG Audio Version : 1
Audio Layer : 2
Audio Bitrate : 64 kbps
Sample Rate : 32000
Channel Mode : Single Channel
Mode Extension : Bands 4-31
Copyright Flag : True
Original Media : True
Emphasis : None
Image Width : 640
Image Height : 480
Aspect Ratio : 1:1
Frame Rate : 30 fps
Video Bitrate : Variable
Image Size : 640x480
----------------------------------------------
Metadata for MP4 file
ExifTool Version Number : 9.79
File Name : MOV03521.mp4
Directory : E:/Users/Owner/Desktop/test
File Size : 7.6 MB
File Modification Date/Time : 2015:01:10 23:56:23+01:00
File Access Date/Time : 2015:01:10 23:56:23+01:00
File Creation Date/Time : 2015:01:10 23:56:23+01:00
File Permissions : rw-rw-rw-
File Type : MP4
MIME Type : video/mp4
Major Brand : MP4 v2 [ISO 14496-14]
Minor Version : 0.2.0
Compatible Brands : isom, iso2, avc1, mp41
Movie Data Size : 7916245
Movie Data Offset : 48
Movie Header Version : 0
Modify Date : 0000:00:00 00:00:00
Time Scale : 1000
Duration : 20.10 s
Preferred Rate : 1
Preferred Volume : 100.00%
Preview Time : 0 s
Preview Duration : 0 s
Poster Time : 0 s
Selection Time : 0 s
Selection Duration : 0 s
Current Time : 0 s
Next Track ID : 3
Track Header Version : 0
Track Create Date : 0000:00:00 00:00:00
Track Modify Date : 0000:00:00 00:00:00
Track ID : 1
Track Duration : 20.10 s
Track Layer : 0
Track Volume : 0.00%
Image Width : 640
Image Height : 480
Graphics Mode : srcCopy
Op Color : 0 0 0
Compressor ID : avc1
Source Image Width : 640
Source Image Height : 480
X Resolution : 72
Y Resolution : 72
Bit Depth : 24
Video Frame Rate : 30
Matrix Structure : 1 0 0 0 1 0 0 0 1
Media Header Version : 0
Media Create Date : 0000:00:00 00:00:00
Media Modify Date : 0000:00:00 00:00:00
Media Time Scale : 32000
Media Duration : 20.06 s
Media Language Code : und
Handler Description : Mono
Balance : 0
Audio Format : mp4a
Audio Channels : 2
Audio Bits Per Sample : 16
Audio Sample Rate : 32000
Track 2 Name : Mono
Handler Type : Metadata
Handler Vendor ID : Apple
Encoder : HandBrake 0.10.0 2014112200
XMP Toolkit : Image::ExifTool 9.79
Create Date : 2015:01:01 11:05:06
Avg Bitrate : 3.15 Mbps
Image Size : 640x480
Rotation : 0
------------------------------------- -
If there is no better solution than re-encoding, could I ask for an advice on what settings should be used to have the same quality of video and audio in the output? Thanks!
-
-
Target should be Mp4 having the same video and audio quality as the original file (MPG1) - please see above the mediainfo data. I store my mpgs in Dropbox. When I open them in my iPhone/iPad Dropbox app or Carousel app they all play well, even though they are mpgs and not MP4 files. The only problem with the mpg files is that they are missing the "createdate" time tag and therefore cannot be indexed in the Carousel timeline. That's why I would like to re-encode them in MP4 format, but without compromising on the quality of the video and audio. I guess a combination of H264/AAC conversion will be fine, but I do not know how to get the same bitrate and other video and audio data in the output. I do not care about the output file size as I am only interested in preserving the quality of the video and audio of the file. Is this the right way to go or should remuxing be better in this case?
-
I have just done that and cannot see the difference with my own eyes. Vidcoder and Handbrake seem to have the same engine and have minimal differences in the output file (compared to FFMPEG command line conversion). Is it better to use FFMPEG or Vidcoder/Handbrake in this simple conversion process (I mean simple because of only one adjustment element - constant quality value).
-
This is not relevant - both should provide comparable results.
My comment - you can't expect that H.264 will encode MPG1 with same bitrate if H.264 was designed to provide around 3 - 4 times lower bitrate for same/comparable quality.
Follow Baldrick advise - use CRF (quality) factor http://en.wikibooks.org/wiki/MeGUI/x264_Settings#crf - bitrate should be at least 50% of previous one with similar quality (same quality is not possible as recoding always reduce quality). -
Thanks! Everything is clear now. I will proceed as advised. On another note - I have also tried remuxing the mpg file into MP4 (ffmpeg -i input.mpg -c copy output.mp4), but did not get the "clean" remuxing result out. It seems as if the problem is in LAV encoder
[mp4 @ 00000000044aaae0] Non-monotonous DTS in output stream 0:0; previous: 0, c urrent: 0; changing to 1. This may result in incorrect timestamps in the output file. frame= 603 fps=0.0 q=-1.0 Lsize= 23523kB time=00:00:20.12 bitrate=9575.5kbits /s video:23356kB audio:157kB subtitle:0kB other streams:0kB global headers:0kB muxi ng overhead: 0.038621%. Anyone knows why remuxing does not work flawlessly here? Or is it a bad idea (remuxing) compared to re-encoding (H264/AAC)?
-
The duration of the audio and video in the MPG are slightly different and this can cause strange behavior. Try remuxing into MKV:
Code:ffmpeg -i "MOV03521.MPG" -map 0:0 -map 0:1 -c:v copy -c:a copy "MOV03521.MKV"
Code:ffmpeg -i "MOV03521.MPG" -map 0:0 -map 0:1 -c:v copy -c:a copy -vf "setpts=PTS-STARTPTS" -af "asetpts=PTS-STARTPTS" "MOV03521.MKV"
I'm the developer behind FFQueue. My posts might reflect this! ;-) -
TorBru, this probably works, but MKV metadata cannot be edited (I would like to be able to edit the MKV metadata; in particular the metadata field: createdate). So, I guess I am stuck with the re-encoding
-
Of course it can be re-edited. Though you might have to resort to hexediting on occasion. Also try MKVpropedit.
And Elecard's free Video Format Analyzer is very handy with showing you the tree structure of AVI, MKV & MOV/MP4 files (with which you could then hexedit).
Scott -
I downloaded MKVpropedit (JMkvpropedit_1.3.3.1) - as recommended - but could not get it to change the date of creation of my mkv file. It must be the damn MPG file within it that forbids any date adding. Do you know if we could somehow trick the MPG file and edit e.g. its video or audio stream (date-wise)? Could we embed XMP-data to the MPG file somehow? Or can the MPG file be hex-edited?
-
Since the MP4 container gives you the settings you ned, you might try to remux you video from MKV to MP4:
Code:ffmpeg -i "MOV03521.MKV" -map 0:0 -map 0:1 -c:v copy -c:a copy "MOV03521.MP4"
I'm the developer behind FFQueue. My posts might reflect this! ;-) -
Thanks TorBru, but it did not work
The operation completed with an error: [mp4 @ 000000000474c4a0] Non-monotonous DTS in output stream 0:0; previous: 528, current: 528; changing to 529. This may result in incorrect timestamps in the output file.
-
If you want the MP4 container you'll probably need re-encoding. Have you tryed to open the MKV with VLC Player, click Tools, select Media information, edit the information and click the "Save metadata" button that appears in the bottom? This might solve the metadata issue with MKV..
I'm the developer behind FFQueue. My posts might reflect this! ;-) -
Thanks! The only thing that works is re-encoding the file to MP4, after which it is then possible to edit metadata.