FORUMS: list search recent posts

ffmpeg uncompressed avi to x264

COW Forums : FFmpeg

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Gary Peterson
ffmpeg uncompressed avi to x264
on Aug 3, 2013 at 2:32:56 pm

Hello this is my first post. I'm a retired software engineer and am doing a lot of video work for my church and enjoy playing around with video. On to my question.

I take video with a Panasonic V700 and usually create uncompressed avi files so I can edit them frame by frame using VirtualDub. I like to cut in things really tight. But for this question I have 10 short MTS clips that have been saved using an Avisynth script through VirtualDub into an uncompressed avi file (video and audio). What I want to do is use ffmpeg to create a new avi file using the x264 and mp3 codec but haven't been able to get a playable file. Here's my command line.

ffmpeg -i "MTS-07.avi" -f rawvideo -pixel_format bgr24 -vcodec libx264 -b:v 2000k -acodec libmp3lame -ar 48000 -ab 192k -y MTS-07-x264-mp3.avi

I've tried a few different versions of this command line with no success. So if anyone can give me a workable solution I'd really appreciate it. Thanks for any help.

Hey. I know what I'm doing is probably a little bit outside the box but I'm looking for a solution to my problem not a different way of doing it. With that said I'd love any options to, but a solution to my problem is what I'm looking for most. Thanks again for any help.


Return to posts index

Reuben Martin
Re: ffmpeg uncompressed avi to x264
on Aug 4, 2013 at 1:25:24 am

The order of the CLI arguments matters. Any options pertaining to the source file needs to go in front of the "-i" option, otherwise they are in reference to your desired output.

ffmpeg -f rawvideo -pix_fmt bgr24 -i "MTS-07.avi" -vcodec libx264 -b:v 2000k -acodec libmp3lame -ar 48000 -ab 192k -y MTS-07-x264-mp3.avi


Also, AVI is a sloppy format for codecs that are not intra-frame only codecs. You would probably be better of putting it in an mp4 container or something similar.


Return to posts index

Gary Peterson
Re: ffmpeg uncompressed avi to x264
on Aug 4, 2013 at 5:40:20 am

Thanks for the info it helped, not completely but at least I have some video now, but still no audio. I knew about the proper order of options but since I don't use ffmpeg much I forgot about it, so thanks.

Here's my command line now.

ffmpeg -f rawvideo -pix_fmt bgr24 -video_size 1280x720 -r 29.970 -i MTS-07.avi -vcodec libx264 -pix_fmt yuv420p -b:v 2000k -acodec libmp3lame -ac 2 -ar 48000 -ab 192000 -y MTS-07-x264-mp3.avi

Now I get an AVI file that will play but the video is the wrong size and flops around and the colors are wrong.

I still use the old Media Player Classic - Home Cinema which after doing more research needed the pix_format set to yuv420p, it was using 422 which it wouldn't display.

If it helps here's what ffplay puts out when playing the source avi.

Input #0, avi, from 'mts-07.avi':
Duration: 00:00:14.48, start: 0.000000, bitrate: 664443 kb/s
Stream #0:0: Video: rawvideo, bgr24, 1280x720, 29.97 tbr, 29.
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000
21.93 A-V: -0.008 fd= 7 aq= 0KB vq= 0KB sq= 0B f=0/0

Thanks for your help.


Return to posts index


Reuben Martin
Re: ffmpeg uncompressed avi to x264
on Aug 5, 2013 at 1:02:43 am

I've encoded video with the same settings and it plays back fine with ffplay. I have no way to know what is causing issues with MPC. I very rarely touch windows machines anymore, so I can't help you.

Note that for the input frame rate, you will probably want to use "-r 30000/1001" rather than "-r 29.970".


Return to posts index

Gary Peterson
Re: ffmpeg uncompressed avi to x264
on Aug 5, 2013 at 1:02:20 pm

Thanks for your help I'll continue to work on it. It's odd how this is such a problem because I wouldn't have expected it. I've used ffmpeg a number of times and it worked pretty well.

One thing I noticed in Mediainfo is the avi file has a variable frame rate I don't know if that's part of my problem but all the other avi's I make with VirtualDub are constant frame rate. So far I haven't been able to force ffmpeg to create a constant frame rate avi.

Thanks again for your help.


Return to posts index

Gary Peterson
Re: ffmpeg uncompressed avi to x264
on Aug 10, 2013 at 4:10:39 pm

I finally got my problem fixed but I'm not quite sure what happened through the process of finding the problem and fixing the problem. I'm sure that doesn't make sense so I'll explain it.

Recently I've been creating some scripts to use for future projects out of little clips I had. So I created a script (batch file) to use ffmpeg to convert an uncompressed avi file, created using VirtualDub, into an AVI file using x264 video and MP3 audio, and that's where my problem started. Now I thought I tried the simple way first, that would be not telling ffmpeg what the input format was but letting it determine it itself. But at this point I can't remember if I did that or not, but of course that's what worked not the way I was trying to do it.

So here's the two command lines I played with, first the one that Didn't work and second the one that Does work.

THIS DID NOT WORK

ffmpeg -f rawvideo -pix_fmt bgr24 -video_size 1280x720 -r 30000/1001 -i MTS-07-8SEC.avi -vcodec libx264 -pix_fmt yuv420p -b:v 2000k -acodec libmp3lame -ar 48000 -ab 192000 -y TEST1-MTS-07-8SEC-x264-mp3.avi


Since I was giving ffmpeg an uncompressed AVI file I thought I needed to tell it what to expect for an input. But going that route never worked so today I tried it without telling ffmpeg anything but what I wanted for an output, and of course that worked. I really thought I tried that first but I guess I didn't because it works fine.

THIS WORKED

ffmpeg -i MTS-07-8SEC.avi -vcodec libx264 -pix_fmt yuv420p -b:v 2000k -acodec libmp3lame -ar 48000 -ab 192000 -y TEST2-MTS-07-8SEC-x264-mp3.avi


SO. Sorry for being a dummy I usually try the simple way first and then build on it if needed, but not this time I guess. Thanks for all the help I appreciate it.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]