HowTo: Convert mov,avi,mkv to mpeg1,or mp4,or avchd?

Booting, installing, newbie
Message
Author
User avatar
RetroTechGuy
Posts: 2947
Joined: Tue 15 Dec 2009, 17:20
Location: USA

#21 Post by RetroTechGuy »

Bruce B wrote:Spaces are very easy to work around in the script. The characters I would have to test would be things like ' and a couple others. I'll post a modification for spaces when Sylvander reports back.
Thanks man!
To add space support one does like this:

from ${fn}.mpg to "${fn}.mpg"

Another thing that is hard to pass on the CLI in this case * , that's why it is in the script and not to be entered on the CLI
That patch didn't seem to work, but I'll play with it some more (or just wait for the next version)
Primarily I'm interested in seeing if Sylvander will get the file quality he wants, later I'll dress up the script, after I get complaints.
Incidentally, I tried my old script, and the new one. Briefly, the output sizes:

Original .flv = 13MB

My older conversion parameters:
ffmpeg -i "$1" -y -f avi -vtag divx -vcodec mpeg4 -b 800k -g 300 -bf 2 -acodec libmp3lame -ab 128k "$1".avi
results in a 22MB file (and I think the quality is comparable, or perhaps slightly better than below)

And the version "fmpeg -target vcd -y" = 33 MB

Of course, once a script works, it's easy enough to change this around.
As for spaces in filenames, some years ago I donated spacereplace
to Puppy. (I didn't write it, I borrowed it) Is it still included in new releases?
Years ago I had written a widget to do that, but support for spaces has greatly improved since then, so I prefer to just leave them (in my code, I actually removed all of the troublesome characters).
[url=http://murga-linux.com/puppy/viewtopic.php?t=58615]Add swapfile[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]

Sylvander
Posts: 4416
Joined: Mon 15 Dec 2008, 11:06
Location: West Lothian, Scotland, UK

#22 Post by Sylvander »

1. Whew, managed to get some time to make some kind of reply.

2. @Trapster
Being a noob, reluctant to attempt the command line method.
May attempt that later.
Greater knowledge and understanding needed.
I can only hope.

3. @bodbozzle
Installed AVIDemux using the lupusave on my Flash Drive, and now at Lupu-519.
Took a look at that and couldn't understand how to do anything with it [not very obvious/intuitive].
Will try to find instructions for use; 1st attempt to find was unsuccessful.

4. @Bruce B
"I've written [th]is simple script for you to try"
No expert and not good with command line scripts.
I see it uses ffmpeg, and converts flv to mpg.
Is mpg the same as mpeg1? :?

5. @Makoto
(a) OK, think I now understand "Remuxing", if not in detail.

(b) "check the instructions for a list of exactly what can play on the Bravia"
See "Playback via USB".
Which says:
# Files from a USB device need to be compatible with the following file formats.
# - Still images: JPEG format or RAW format (preview only)
# - Music: MP3 format
# - Video: AVCHD, MP4 (AVC) or MPEG1 format (not playable in some cases)


6. @Bruce B
(a) "Makes sense, the first script was made explicitly for .flv input files
With this one run it like this:
filename .mov
filename .avi
"
Clear as mud to me. :?
How do I include the filename and extension, so the code entered at the terminal command prompt is applied to the file to be converted?
And the code is like Greek to me.

(b) "With this one run it like this according to the input file extension.
scriptname .mov
scriptname .avi
"
Still confused. :? :(
We dummies like GUI's.
I'm getting on in years, and may be dead before I ever learn about coding.
Should I want to waste my remaining years learning such stuff?
All I want to do is play some [video etc] files on my TV using the USB socket and a [Flash or Hard Disk] drive!
With all the assistance being given you'd think I'd eventually manage to learn how, eh?

(c) "my script cared, that's why Sylvander had a problem"
I haven't yet tried using any of your scripts.
Have you misunderstood my reply about not needing to convert flv files, because I don't have any?

7. @Makoto
"usually, the instruction manuals are a little more specific about the specifications each of the above filetypes should contain (how they're encoded)....
...or at least, they SHOULD be a little more specific. One can hope, right
"
Unfortunately, the Sony online i-Manual is NOT very detailed, as you will see using the link above in 5(b).
Here's the 1st page of the manual, from which you can go to all the other pages.
The i-Manual can be viewed on the TV using the remote control [not sure if it needs to go out onto the web to fetch].
Rather crazy way of doing things methinks.
You need a separate/independent [printed?] manual when attempting to follow its instructions to make TV configurations. :(

8. @Bruce B
"One thing I do is make files for a low common denominator"
Sounds good to me...
I'm your typical "low common"...er...."denominator".
If I can do it, almost anyone can do it. :D

User avatar
RetroTechGuy
Posts: 2947
Joined: Tue 15 Dec 2009, 17:20
Location: USA

#23 Post by RetroTechGuy »

Sylvander wrote:1. Whew, managed to get some time to make some kind of reply.

2. @Trapster
Being a noob, reluctant to attempt the command line method.
May attempt that later.
It's often easier (i.e. faster) to get results from the command line. Otherwise you have to wait until someone kludges together a GUI...

For example, I took Bruce's script and created a file in "~/my-applications/bin", and pasted the text in (I called it "bruce", to keep track of which one it is).

Now (assuming that permissions are correctly set to "x" = "execute") you have a command "bruce" that will process the files given in the list.

Navigate to your file location, e.g.:

Code: Select all

cd /mnt/sdc1/myvids/
Then run the program:

Code: Select all

bruce .flv
(IIRC, Bruce's script needs to be told the extension, .flv, but then polls its own list from the current directory).
Greater knowledge and understanding needed.
I can only hope.
Here's where I found the ffmpeg parameters that I used above (thanks Neurino):

http://www.murga-linux.com/puppy/viewto ... 325#444325

Here's another thread, and Lobster has a link to using ffmpeg:

http://www.murga-linux.com/puppy/viewto ... 969#235969

So let's assume that you now have a working script, but don't like the original parameters. Just edit the script (open as text) and paste in the new parameters...
[url=http://murga-linux.com/puppy/viewtopic.php?t=58615]Add swapfile[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]

Sylvander
Posts: 4416
Joined: Mon 15 Dec 2008, 11:06
Location: West Lothian, Scotland, UK

#24 Post by Sylvander »

1. Tried another look at Avidemux, but it was no better 2nd time around; I don't see any way to do anything with it. :? :(
Next job [when there's some time to spare] is to look for instructions/manual.

2. @RetroTechGuy
Your instructions make sense to me, so I'll have a go as soon as I have time to spare.
One doubt/uncertainty:
Why .flv in...

Code: Select all

bruce .flv
When I don't have any .flv files?
Shouldn't I specify the extension of the file I wish to convert?
Or doesn't it matter because the program will convert any/all video files held in the folder within which the console->program is run?

User avatar
RetroTechGuy
Posts: 2947
Joined: Tue 15 Dec 2009, 17:20
Location: USA

#25 Post by RetroTechGuy »

Sylvander wrote:1. Tried another look at Avidemux, but it was no better 2nd time around; I don't see any way to do anything with it. :? :(
Next job [when there's some time to spare] is to look for instructions/manual.

2. @RetroTechGuy
Your instructions make sense to me, so I'll have a go as soon as I have time to spare.
One doubt/uncertainty:
Why .flv in...

Code: Select all

bruce .flv
When I don't have any .flv files?
Shouldn't I specify the extension of the file I wish to convert?
Or doesn't it matter because the program will convert any/all video files held in the folder within which the console->program is run?
Well, yes. If you extension is mp4, you enter that, and so forth (.flv seem to be the most common -- especially if you grab things from Youtube).
[url=http://murga-linux.com/puppy/viewtopic.php?t=58615]Add swapfile[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]

User avatar
Makoto
Posts: 1665
Joined: Fri 04 Sep 2009, 01:30
Location: Out wandering... maybe.

#26 Post by Makoto »

Open some of the videos that do work on the Bravia in MediaInfo, in Tree View. You should be able to cut and paste the information that you get from those videos; they'll give some indication as to what the Bravia expects from a video. Theoretically, any video you convert will probably have to match most or all of those details.

Yes, AVIDemux does tend to require a bit of a learning curve. :| You might take a look at the user guides in the "Guides and How to's:" section on this page: http://www.videohelp.com/tools/AviDemux#download. Here's a direct link to the "How to get started with avidemux, edit and convert any video format" guide listed on that page - though I'm not sure Baldrick's guide is specific enough for someone completely new to AVIDemux. :oops:

Edit: Hmm... wonder if Handbrake (http://handbrake.fr/downloads.php) might work/help, in this case. (I don't use it, so I tend to forget about it.) Unfortunately, the few specific topics I found on this forum, with .pet packages, reportedly have dead links.
[ Puppy 4.3.1 JP, Frugal install ] * [ XenialPup 7.5, Frugal install ] * [XenialPup 64 7.5, Frugal install] * [ 4GB RAM | 512MB swap ]
In memory of our beloved American Eskimo puppy (1995-2010) and black Lab puppy (1997-2011).

Bruce B

#27 Post by Bruce B »

Sylvander (et al),

My idea in using ffmpeg presets was primarily to make getting started
easy for you.

The presets are optimized to keep quality high. They are easy to use.
They are not, however, optimized for small output files.

RetroTechGuy noted he could get smaller file sizes using his user defined
parameters to .avi format. And the quality was as good or better than the
preset.

What I think is the primary problem. Our video files are compressed files.
The compression type is lossy, meaning we lose information in making
even the original file. When we convert from one compression format to
another it is very easy to introduce even more losses in the output file.

With computers, a copy operation produces an identical copied file.
Multimedia format conversion is different. Care must be taken to keep
losses to a minimum, if minimal losses are desired effect.

We can for example, tell ffmpeg to sample abc at 4000, but the orginal
only sampled abc at 1000. We keep loses down by overkill, but we end up
with a larger output file.

If the original sampled abc at 1000 and we only sample it at 500, we
introduce losses.
Still confused. Confused Sad
We dummies like GUI's.
I'm getting on in years, and may be dead before I ever learn about coding.
Should I want to waste my remaining years learning such stuff?
Scripts are for lazy people. Suppose I want to play Celtic Woman songs. I
simply type 'celtic' on the CLI and the rest is done for me.

I took interest in this topic AFTER learning the GUI didn't work right for
you. And because the GUI didn't work right for you.

BTW - after reading the posts in this topic, I installed WinFF, another GUI
for ffmpeg. It looks great, but I have to figure out somethings about how
it uses presets.

In the meantime, I recommend anyone to install it. I got mine from a
Debian archive. I opened the archive and manually installed it.

I'm thinking what to do next.

Bruce

~

Sylvander
Posts: 4416
Joined: Mon 15 Dec 2008, 11:06
Location: West Lothian, Scotland, UK

#28 Post by Sylvander »

1. For a moment there I thought I'd succeeded.
Managed to [use FFConvert to] convert a mov file to an mp4, with no sign of reduced quality, but...
When played on the Sony TV...
Only the sound could be heard [codec = libfaac]...
No images [codec = mpeg4].
See 3 below.

2. Previous to this, I'd used Avidemux to "Open" a file [ra.mp4] that plays OK on TV, and looked at its "Properties" as follows:
Video:
codec 4cc: H264
Image size: 1920x800
Aspect ratio: 1:1
Frame rate: 23.976 fps
Frame count: 158972 frames
Total duration: 01:50:30.463
---------------------------------
Global motion compensation: no
Packed bitstream: no
Quarter pixel: no
---------------------------------
Sound:
Codec: AAC
Channels: Stereo
Bitrate: 16000bps/128kbps
Variable bitrate: no
Frequency: 48000 Hz
Total duration: 02:18:10.759
File size 126.51 MB
---------------------------------

3. Using FFConvert:
To convert mov to mp4.
Config choices made [right or wrong?]
-------------------------------------------
Preset = mpeg4-avc
Video:
Codec: mpeg4[didn't play on Sony], H263[complained of error]
Quality: Same as source [sas]
Bitrate (kbps) = 16000
Screensize = sas
Aspect ratio = 16;9
Frame rate = sas
--------------------------
Audio:
Codec = AAC[error], libfaac [suggested by error message, and worked]
Bitrate (kbps) = 128
Sampling (Hz) = same
Channels = sas
--------------------------
File format = mp4
Processing = 1-pass
--------------------------

4. More to follow when time permits.

User avatar
RetroTechGuy
Posts: 2947
Joined: Tue 15 Dec 2009, 17:20
Location: USA

#29 Post by RetroTechGuy »

Sylvander wrote:1. For a moment there I thought I'd succeeded.
Managed to [use FFConvert to] convert a mov file to an mp4, with no sign of reduced quality, but...
When played on the Sony TV...
Only the sound could be heard [codec = libfaac]...
No images [codec = mpeg4].
See 3 below.
[...snip...]

Do you know what codec the Sony TV is looking for?

For example, this guy pulled them from his manual:

http://avidemux.org/admForum/viewtopic.php?id=7979

It is my understanding the ".mp4" is simply a wrapper (as is ".avi"), and the contents/codecs are what matter for playback.
[url=http://murga-linux.com/puppy/viewtopic.php?t=58615]Add swapfile[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]

Bruce B

#30 Post by Bruce B »

Sylvander,

For output to Television maybe the dvd preset is
the one to use. I don't know.

replace vcd and try various others, e.g:

dvd dv dv50 pal-vcd ntsc-svcd


ffmpeg -i ${fn}$1 -target vcd -y ${fn}.mpg

Then use ffplay to test the output file. Learn what target types work.

ffplay filename.mpg

If it looks good send it to the television, see what happens.

Report back

User avatar
bodbozzle
Posts: 45
Joined: Tue 03 Aug 2010, 20:41
Location: El Barrio GMT +1 (de)

#31 Post by bodbozzle »

If it is possible to play these videos by the TV:

Downloads:
http://www.sitasingstheblues.com/watch.html
QuickTime H.264 .mp4

then the presets in Avidemux may look somehow like in the attachment.

- a similar media-file (audio+video codec), contained as flv instead of mp4:
http://www.youtube.com/watch?v=oW0jvJC2 ... re=related
(catched with Video DownloadHelper)
Attachments
mpeg4avc.jpg
(80.36 KiB) Downloaded 235 times

Sylvander
Posts: 4416
Joined: Mon 15 Dec 2008, 11:06
Location: West Lothian, Scotland, UK

#32 Post by Sylvander »

1. Phoned Sony UK Tech. help at 0844 846 555.
He said:
(a) Need to play mp4 files [they include both video & sound].
He said mpeg1 is video only.

(b) The file needs to be on its ORIGINAL SOURCE.
i.e. I'd need to download it straight onto a USB Flash Drive or HDD.

(c) If the file was originally on a different source...
That fact is recorded somewhere inside the file...
And I copy/move it to another location...
Say on a different device, like a Flash Drive...
The TV will detect that and [possibly?] refuse to play it.

(d) Anyone know how to fix that?

User avatar
Makoto
Posts: 1665
Joined: Fri 04 Sep 2009, 01:30
Location: Out wandering... maybe.

#33 Post by Makoto »

Sylvander wrote: (b) The file needs to be on its ORIGINAL SOURCE.
i.e. I'd need to download it straight onto a USB Flash Drive or HDD.

(c) If the file was originally on a different source...
That fact is recorded somewhere inside the file...
And I copy/move it to another location...
Say on a different device, like a Flash Drive...
The TV will detect that and [possibly?] refuse to play it.

(d) Anyone know how to fix that?
I'm sorry - this sounds to me like either the representative you spoke to doesn't know what he or she is talking about, or is BSing you. The TV's arbitrarily going to refuse to play a file because it may have been copied?

An MP4 video is just like any other file - a collection of bytes on a drive, or disc media. Copy it to another drive or disc, and barring any hardware problems... it'll still be the exact same collection of bytes. How is the TV supposed to know the difference?

Still, I wouldn't put it past Sony to TRY to throw in all sorts of restrictions, turn off your TV if you even THINK of playing a ripped Blu-Ray on it, or something. :roll:

At this rate, you might be better off getting a media player, like the Western Digital TV (WDTV) models, or a (non-Sony?) BD player that can handle an array of video file formats, if you're going to end up going through so much trouble trying to get videos to work with the TV. :|
[ Puppy 4.3.1 JP, Frugal install ] * [ XenialPup 7.5, Frugal install ] * [XenialPup 64 7.5, Frugal install] * [ 4GB RAM | 512MB swap ]
In memory of our beloved American Eskimo puppy (1995-2010) and black Lab puppy (1997-2011).

Bruce B

#34 Post by Bruce B »

Sylvander,

I'll try and help how I can. But, I must confess, "I don't even use television" But I am following this topic.

The computer is my TV and although it doesn't have a huge screen, I'm close enough to it, it might as well be a large screen. Sounds weird to many I suppose.

Bruce

Bruce B

#35 Post by Bruce B »

~ deleted due to forum posting problem ~
Last edited by Bruce B on Fri 07 Jan 2011, 20:47, edited 1 time in total.

Bruce B

#36 Post by Bruce B »

~
Last edited by Bruce B on Thu 06 Jan 2011, 20:01, edited 1 time in total.

Bruce B

#37 Post by Bruce B »

deleted duplicate (forum error, honestly - not my fault)
Last edited by Bruce B on Thu 06 Jan 2011, 19:49, edited 1 time in total.

Bruce B

#38 Post by Bruce B »

~ deleted due to forum posting problem ~
Last edited by Bruce B on Fri 07 Jan 2011, 20:47, edited 2 times in total.

User avatar
RetroTechGuy
Posts: 2947
Joined: Tue 15 Dec 2009, 17:20
Location: USA

#39 Post by RetroTechGuy »

Sylvander wrote:1. Phoned Sony UK Tech. help at 0844 846 555.
He said:
(a) Need to play mp4 files [they include both video & sound].
He said mpeg1 is video only.

(b) The file needs to be on its ORIGINAL SOURCE.
i.e. I'd need to download it straight onto a USB Flash Drive or HDD.

(c) If the file was originally on a different source...
That fact is recorded somewhere inside the file...
And I copy/move it to another location...
Say on a different device, like a Flash Drive...
The TV will detect that and [possibly?] refuse to play it.
Good grief! So it sounds like Sony has implemented DRM in their hardware...
(d) Anyone know how to fix that?
Yeah, don't buy a Sony...

Or play it from a computer, using VGA and sound input...

You may recall this from Sony:
http://en.wikipedia.org/wiki/Sony_BMG_c ... it_scandal
[url=http://murga-linux.com/puppy/viewtopic.php?t=58615]Add swapfile[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]

User avatar
RetroTechGuy
Posts: 2947
Joined: Tue 15 Dec 2009, 17:20
Location: USA

#40 Post by RetroTechGuy »

deleted dupes (some sort of crash occurred during posting)
Last edited by RetroTechGuy on Thu 06 Jan 2011, 20:31, edited 1 time in total.
[url=http://murga-linux.com/puppy/viewtopic.php?t=58615]Add swapfile[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]

Post Reply