Support and General Use > Plugins/Viewers

Wrong duration header when joining .mpg files with cat:

(1/3) > >>

jccc:
When I try to join a set of mpegs (for example "cat *.mpg > joined.mpg"), the length header is set--incorrectly--to the length of the last video in the set.  So instead of 300 minutes, the video player thinks it's, say, 20 minutes.

I've not seen this issue mentioned anywhere that people suggest this joining trick.  Am I the only one?  Is there a way I can set the length property of the .mpg file after-the-fact?

Maybe I could run it through ffmpeg again with -sameq to keep the same video quality, but I don't want it re-coding the audio either.  (My attempt just now setting the same audio bitrate fattened my file up significantly.)  I just need the correct length to be set.

saratoga:

--- Quote from: jccc on September 06, 2010, 07:54:35 AM ---When I try to join a set of mpegs (for example "cat *.mpg > joined.mpg"), the length header is set--incorrectly--to the length of the last video in the set.  So instead of 300 minutes, the video player thinks it's, say, 20 minutes.

--- End quote ---

I'm not sure how MPG works, but I doubt a binary join is going to work very well.  Short of running through the entire file to see how many segments there are, how would you even determine the file length?

dreamlayers:
If you want to properly join .mpg files, you really need to use software which is designed for that.  Try mpeg toolbox or MPEG Streamclip.

jccc:

--- Quote from: saratoga on September 06, 2010, 10:47:27 AM ---I'm not sure how MPG works, but I doubt a binary join is going to work very well.  Short of running through the entire file to see how many segments there are, how would you even determine the file length?

--- End quote ---

A Google search for how to join multiple .mpg files returns page after page of suggestions simply to use cat.  Also, the FAQ for ffmpeg (suggested by Rockbox's docs for the .mpg player plugin) itself says to use cat.

The test I mentioned above gave me a fully joined mpg file.  (I can play this video, although different players get confused in different ways by the incorrect length header.)  And running this file through ffmpeg once more (ostensibly unchanged w/ -sameq) even gives me the correct length header, but fattens up my file.

Maybe this isn't the place for me to ask the question.  I guess I'll ask on those forums that mention cat, and I'll try mpgtx, but I'd rather not have to install/set up and use yet another custom tool in the chain for doing this.

Llorean:
Instead of using sameq, have you tried using the "copy" codec, to just copy the stream into a new mpeg file? I'm pretty sure sameq decodes and re-encodes which not only takes longer, but as you've noted results in a file size increase.

Navigation

[0] Message Index

[#] Next page

Go to full version