<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Webologist &#187; mpg to flv</title>
	<atom:link href="http://www.webologist.co.uk/tag/mpg-to-flv/feed" rel="self" type="application/rss+xml" />
	<link>http://www.webologist.co.uk</link>
	<description>Internet News, Web Design, Development, Hosting and Optimisation</description>
	<lastBuildDate>Tue, 07 Sep 2010 12:40:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=6845</generator>
		<item>
		<title>Sound Lost When Transferring from MPG to FLV</title>
		<link>http://www.webologist.co.uk/2008/03/sound-lost-when-transferring-from-mpg.html</link>
		<comments>http://www.webologist.co.uk/2008/03/sound-lost-when-transferring-from-mpg.html#comments</comments>
		<pubDate>Mon, 24 Mar 2008 20:04:00 +0000</pubDate>
		<dc:creator>Webologist</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[codecs]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mpg to flv]]></category>
		<category><![CDATA[no sound]]></category>

		<guid isPermaLink="false">http://webologist.co.uk/?p=77</guid>
		<description><![CDATA[I have a problem that I am struggling to resolve. When I convert a video recorded using my Sony Camcorder from MPG to FLV, using FFMPEG, I lose the sound. I have done a little reading, and am currently struggling to fix this problem, but I think that is has something to do with some sound codecs not being installed. One one site I have read: &#8220;By default flv selects mp3 audio but that is not configured in your ffmpeg. Install lame, make distclean, add &#8211;enable-mp3lame to configure command, make, retry. Some containers select default codecs that may not be installed, and do so silently&#8221; &#8211; from mplayerhq.hu So, looks like I need to install something, but what and how? Maybe there is something listed in the synaptic package manager that I can install&#8230;&#8230;]]></description>
			<content:encoded><![CDATA[<!--CusAds1--><p>I have a problem that I am struggling to resolve. When I convert a video recorded using my Sony Camcorder from MPG to FLV, using FFMPEG, I lose the sound. I have done a little reading, and am currently struggling to fix this problem, but I think that is has something to do with some sound codecs not being installed. One one site I have read:</p>
<p>&#8220;By default flv selects mp3 audio but that is not configured in your<br />
ffmpeg. Install lame, make distclean, add &#8211;enable-mp3lame to configure<br />
command, make, retry. Some containers select default codecs that may not be<br />
installed, and do so silently&#8221; &#8211; from <a href="http://lists.mplayerhq.hu/pipermail/ffmpeg-user/2005-October/001423.html">mplayerhq.hu</a></p>
<p>So, looks like I need to install something, but what and how? Maybe there is something listed in the synaptic package manager that I can install&#8230;&#8230;</p>

<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>]]></content:encoded>
			<wfw:commentRss>http://www.webologist.co.uk/2008/03/sound-lost-when-transferring-from-mpg.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Converting MPG to FLV Using FFMPEG</title>
		<link>http://www.webologist.co.uk/2008/03/converting-mpg-to-flv-using-ffmpeg.html</link>
		<comments>http://www.webologist.co.uk/2008/03/converting-mpg-to-flv-using-ffmpeg.html#comments</comments>
		<pubDate>Mon, 24 Mar 2008 17:24:00 +0000</pubDate>
		<dc:creator>Webologist</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[flash player]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mpg to flv]]></category>

		<guid isPermaLink="false">http://webologist.co.uk/?p=76</guid>
		<description><![CDATA[I have recently bought a Sony DCR-SR35E Hard Disc Drive Handycam to film my baby son, but was struggling to find a way to showing the videos online, without having to resort to using public video sharing portals such as YouTube. The solution is to use FFMPEG to convert the .mpg files (which Sony Camcorders record in) and then set up a simple flash video viewer. I am fortunate in that a good friend knocked up some code for me to show the videos, and pointed me in the right direction to get them playing. To convert the .mpg file into a .flv one, I installed FFMPEG onto my Linux machine, and copied all the videos files over to there. Installing FFMPEG was easy using the Synaptic Package Manager which comes as standard on Ubuntu. Once installed, I simple navigated to the directory in which the MPG files were stored and then entered the following command: ffmpeg -i camcordervideo.MPG -f flv newfile.flv This worked OK, but not ideal. The thing about FFMPEG is that there are a plethora of options, and this created a new file based on default settings. The file created was too compressed for my liking, and [...]]]></description>
			<content:encoded><![CDATA[<!--CusAds1--><p>I have recently bought a <a href="http://astore.amazon.co.uk/videophile.co.uk-21/detail/B0011UFE9K/026-8239833-1236461">Sony DCR-SR35E Hard Disc Drive Handycam</a> to film my baby son, but was struggling to find a way to showing the videos online, without having to resort to using public video sharing portals such as YouTube.</p>
<p>The solution is to use FFMPEG to convert the .mpg files (which Sony Camcorders record in) and then set up a simple flash video viewer. I am fortunate in that a good friend knocked up some code for me to show the videos, and pointed me in the right direction to get them playing.</p>
<p>To convert the .mpg file into a .flv one, I installed FFMPEG onto my Linux machine, and copied all the videos files over to there. Installing FFMPEG was easy using the Synaptic Package Manager which comes as standard on Ubuntu. Once installed, I simple navigated to the directory in which the MPG files were stored and then entered the following command:</p>
<p>ffmpeg -i camcordervideo.MPG -f flv newfile.flv</p>
<p>This worked OK, but not ideal. The thing about FFMPEG is that there are a plethora of options, and  this created a new file based on default settings. The file created was too compressed for my liking, and had no sound. It is OK for now, but I now need to review the manual (man ffmpeg) to learn the various transcoding options to get better quality image and to keep the sound.</p>
<p>If you know the best commands for converting mpg to vlf, please let me know, so that I can compile a list of the most useful commands.</p>
<p>Here is the out put of the <span style="font-weight:bold;">ffmpeg manual</span>:</p>
<p>NAME<br />
ffmpeg &#8211; FFmpeg video converter</p>
<p>SYNOPSIS<br />
ffmpeg [[infile options][-i infile]]&#8230; {[outfile options] outfile}&#8230;</p>
<p>DESCRIPTION<br />
If no input file is given, audio/video grabbing is done.</p>
<p>As a general rule, options are applied to the next specified file. For example, if you give the -b 64 option, it<br />
sets the video bitrate of the next file. The format option may be needed for raw input files.</p>
<p>By default, FFmpeg tries to convert as losslessly as possible: It uses the same audio and video parameters for the<br />
outputs as the one specified for the inputs.</p>
<p>OPTIONS<br />
Main options</p>
<p>-L  Show license.</p>
<p>-h  Show help.</p>
<p>-formats<br />
Show available formats, codecs, protocols, &#8230;</p>
<p>-f fmt<br />
Force format.</p>
<p>-i filename<br />
input filename</p>
<p>-y  Overwrite output files.</p>
<p>-t duration<br />
Set the recording time in seconds.  &#8220;hh:mm:ss[.xxx]&#8221; syntax is also supported.</p>
<p>-ss position<br />
Seek to given time position in seconds.  &#8220;hh:mm:ss[.xxx]&#8221; syntax is also supported.</p>
<p>-title string<br />
Set the title.</p>
<p>-author string<br />
Set the author.</p>
<p>-copyright string<br />
Set the copyright.</p>
<p>-comment string<br />
Set the comment.</p>
<p>-target type<br />
Specify target file type (&#8220;vcd&#8221;, &#8220;svcd&#8221;, &#8220;dvd&#8221;, &#8220;dv&#8221;, &#8220;pal-vcd&#8221;, &#8220;ntsc-svcd&#8221;, &#8230; ). All the format options<br />
(bitrate, codecs, buffer sizes) are then set automatically. You can just type:</p>
<p>ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg</p>
<p>Nevertheless you can specify additional options as long as you know they do not conflict with the standard, as<br />
in:</p>
<p>ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg</p>
<p>-hq Activate high quality settings.</p>
<p>-itsoffset offset<br />
Set the input time offset in seconds.  &#8220;[-]hh:mm:ss[.xxx]&#8221; syntax is also supported.  This option affects all<br />
the input files that follow it.  The offset is added to the timestamps of the input files.  Specifying a posi‐<br />
tive offset means that the corresponding streams are delayed by ’offset’ seconds.</p>
<p>Video Options</p>
<p>-b bitrate<br />
Set the video bitrate in kbit/s (default = 200 kb/s).<br />
-r fps<br />
Set frame rate (default = 25).</p>
<p>-s size<br />
Set frame size. The format is wxh (default = 160&#215;128).  The following abbreviations are recognized:</p>
<p>sqcif<br />
128&#215;96</p>
<p>qcif<br />
176&#215;144</p>
<p>cif 352&#215;288</p>
<p>4cif<br />
704&#215;576</p>
<p>-aspect aspect<br />
Set aspect ratio (4:3, 16:9 or 1.3333, 1.7777).</p>
<p>-croptop size<br />
Set top crop band size (in pixels).</p>
<p>-cropbottom size<br />
Set bottom crop band size (in pixels).</p>
<p>-cropleft size<br />
Set left crop band size (in pixels).</p>
<p>-cropright size<br />
Set right crop band size (in pixels).</p>
<p>-padtop size<br />
Set top pad band size (in pixels).</p>
<p>-padbottom size<br />
Set bottom pad band size (in pixels).<br />
-padleft size<br />
Set left pad band size (in pixels).</p>
<p>-padright size<br />
Set right pad band size (in pixels).</p>
<p>-padcolor (hex color)<br />
Set color of padded bands. The value for padcolor is expressed as a six digit hexadecimal number where the<br />
first two digits represent red, the middle two digits green and last two digits blue (default = 000000<br />
(black)).</p>
<p>-vn Disable video recording.</p>
<p>-bt tolerance<br />
Set video bitrate tolerance (in kbit/s).</p>
<p>-maxrate bitrate<br />
Set max video bitrate tolerance (in kbit/s).</p>
<p>-minrate bitrate<br />
Set min video bitrate tolerance (in kbit/s).</p>
<p>-bufsize size<br />
Set rate control buffer size (in kbit).</p>
<p>-vcodec codec<br />
Force video codec to codec. Use the &#8220;copy&#8221; special value to tell that the raw codec data must be copied as is.</p>
<p>-sameq<br />
Use same video quality as source (implies VBR).</p>
<p>-pass n<br />
Select the pass number (1 or 2). It is useful to do two pass encoding. The statistics of the video are<br />
recorded in the first pass and the video is generated at the exact requested bitrate in the second pass.</p>
<p>-passlogfile file<br />
Set two pass logfile name to file.<br />
Advanced Video Options</p>
<p>-g gop_size<br />
Set the group of pictures size.</p>
<p>-intra<br />
Use only intra frames.</p>
<p>-qscale q<br />
Use fixed video quantiser scale (VBR).</p>
<p>-qmin q<br />
minimum video quantiser scale (VBR)</p>
<p>-qmax q<br />
maximum video quantiser scale (VBR)</p>
<p>-qdiff q<br />
maximum difference between the quantiser scales (VBR)</p>
<p>-qblur blur<br />
video quantiser scale blur (VBR)</p>
<p>-qcomp compression<br />
video quantiser scale compression (VBR)</p>
<p>-rc_init_cplx complexity<br />
initial complexity for single pass encoding</p>
<p>-b_qfactor factor<br />
qp factor between P- and B-frames</p>
<p>-i_qfactor factor<br />
qp factor between P- and I-frames</p>
<p>-b_qoffset offset<br />
qp offset between P- and B-frames<br />
-i_qoffset offset<br />
qp offset between P- and I-frames</p>
<p>-rc_eq equation<br />
Set rate control equation (default = &#8220;tex^qComp&#8221;).</p>
<p>-rc_override override<br />
rate control override for specific intervals</p>
<p>-me method<br />
Set motion estimation method to method.  Available methods are (from lowest to best quality):</p>
<p>zero<br />
Try just the (0, 0) vector.</p>
<p>phods<br />
log<br />
x1<br />
epzs<br />
(default method)</p>
<p>full<br />
exhaustive search (slow and marginally better than epzs)</p>
<p>-dct_algo algo<br />
Set DCT algorithm to algo. Available values are:</p>
<p>0   FF_DCT_AUTO (default)</p>
<p>1   FF_DCT_FASTINT</p>
<p>2   FF_DCT_INT</p>
<p>3   FF_DCT_MMX</p>
<p>4   FF_DCT_MLIB</p>
<p>5   FF_DCT_ALTIVEC</p>
<p>-idct_algo algo<br />
Set IDCT algorithm to algo. Available values are:</p>
<p>0   FF_IDCT_AUTO (default)</p>
<p>1   FF_IDCT_INT</p>
<p>2   FF_IDCT_SIMPLE</p>
<p>3   FF_IDCT_SIMPLEMMX</p>
<p>4   FF_IDCT_LIBMPEG2MMX</p>
<p>5   FF_IDCT_PS2</p>
<p>6   FF_IDCT_MLIB</p>
<p>7   FF_IDCT_ARM</p>
<p>8   FF_IDCT_ALTIVEC</p>
<p>9   FF_IDCT_SH4</p>
<p>10  FF_IDCT_SIMPLEARM</p>
<p>-er n<br />
Set error resilience to n.</p>
<p>1   FF_ER_CAREFUL (default)</p>
<p>2   FF_ER_COMPLIANT</p>
<p>3   FF_ER_AGGRESSIVE</p>
<p>4   FF_ER_VERY_AGGRESSIVE</p>
<p>-ec bit_mask<br />
Set error concealment to bit_mask. bit_mask is a bit mask of the following values:</p>
<p>1   FF_EC_GUESS_MVS (default = enabled)</p>
<p>2   FF_EC_DEBLOCK (default = enabled)</p>
<p>-bf frames<br />
Use ’frames’ B-frames (supported for MPEG-1, MPEG-2 and MPEG-4).</p>
<p>-mbd mode<br />
macroblock decision</p>
<p>0   FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in FFmpeg).</p>
<p>1   FF_MB_DECISION_BITS: Choose the one which needs the fewest bits.</p>
<p>2   FF_MB_DECISION_RD: rate distortion</p>
<p>-4mv<br />
Use four motion vector by macroblock (MPEG-4 only).</p>
<p>-part<br />
Use data partitioning (MPEG-4 only).</p>
<p>-bug param<br />
Work around encoder bugs that are not auto-detected.</p>
<p>-strict strictness<br />
How strictly to follow the standards.</p>
<p>-aic<br />
Enable Advanced intra coding (h263+).</p>
<p>-umv<br />
Enable Unlimited Motion Vector (h263+)</p>
<p>-deinterlace<br />
Deinterlace pictures.</p>
<p>-interlace<br />
Force interlacing support in encoder (MPEG-2 and MPEG-4 only).  Use this option if your input file is inter‐<br />
laced and you want to keep the interlaced format for minimum losses.  The alternative is to deinterlace the<br />
input stream with -deinterlace, but deinterlacing introduces losses.</p>
<p>-psnr<br />
Calculate PSNR of compressed frames.</p>
<p>-vstats<br />
Dump video coding statistics to vstats_HHMMSS.log.</p>
<p>-vhook module<br />
Insert video processing module. module contains the module name and its parameters separated by spaces.</p>
<p>Audio Options</p>
<p>-ar freq<br />
Set the audio sampling frequency (default = 44100 Hz).</p>
<p>-ab bitrate<br />
Set the audio bitrate in kbit/s (default = 64).</p>
<p>-ac channels<br />
Set the number of audio channels (default = 1).</p>
<p>-an Disable audio recording.</p>
<p>-acodec codec<br />
Force audio codec to codec. Use the &#8220;copy&#8221; special value to specify that the raw codec data must be copied as<br />
is.</p>
<p>Audio/Video grab options</p>
<p>-vd device<br />
sEt video grab device (e.g. /dev/video0).</p>
<p>-vc channel<br />
Set video grab channel (DV1394 only).</p>
<p>-tvstd standard<br />
Set television standard (NTSC, PAL (SECAM)).</p>
<p>-dv1394<br />
Set DV1394 grab.</p>
<p>-ad device<br />
Set audio device (e.g. /dev/dsp).</p>
<p>Advanced options</p>
<p>-map file:stream<br />
Set input stream mapping.</p>
<p>-debug<br />
Print specific debug info.</p>
<p>-benchmark<br />
Add timings for benchmarking.</p>
<p>-hex<br />
Dump each input packet.</p>
<p>-bitexact<br />
Only use bit exact algorithms (for codec testing).</p>
<p>-ps size<br />
Set packet size in bits.</p>
<p>-re Read input at native frame rate. Mainly used to simulate a grab device.</p>
<p>-loop<br />
Loop over the input stream. Currently it works only for image streams. This option is used for automatic<br />
FFserver testing.</p>
<p>-loop_output number_of_times<br />
Repeatedly loop output for formats that support looping such as animated GIF (0 will loop the output<br />
infinitely).</p>
<p>-vsync parameter<br />
Video sync method. Video will be stretched/squeezed to match the timestamps, it is done by duplicating and<br />
dropping frames. With -map you can select from which stream the timestamps should be taken. You can leave<br />
either video or audio unchanged and sync the remaining stream(s) to the unchanged one.</p>
<p>-async samples_per_second<br />
Audio sync method. &#8220;Stretches/squeezes&#8221; the audio stream to match the timestamps, the parameter is the maximum<br />
samples per second by which the audio is changed.  -async 1 is a special case where only the start of the<br />
audio stream is corrected without any later correction.</p>
<p>FFmpeg formula evaluator</p>
<p>When evaluating a rate control string, FFmpeg uses an internal formula evaluator.</p>
<p>The following binary operators are available: &#8220;+&#8221;, &#8220;-&#8221;, &#8220;*&#8221;, &#8220;/&#8221;, &#8220;^&#8221;.</p>
<p>The following unary operators are available: &#8220;+&#8221;, &#8220;-&#8221;, &#8220;(&#8230;)&#8221;.</p>
<p>The following functions are available:</p>
<p>sinh(x)<br />
cosh(x)<br />
tanh(x)<br />
sin(x)<br />
cos(x)<br />
tan(x)<br />
exp(x)<br />
log(x)<br />
squish(x)<br />
gauss(x)<br />
abs(x)<br />
max(x, y)<br />
min(x, y)<br />
gt(x, y)<br />
lt(x, y)<br />
eq(x, y)<br />
bits2qp(bits)<br />
qp2bits(qp)</p>
<p>The following constants are available:</p>
<p>PI<br />
E<br />
iTex<br />
pTex<br />
tex<br />
mv<br />
fCode<br />
iCount<br />
mcVar<br />
var<br />
isI<br />
isP<br />
isB<br />
avgQP<br />
qComp<br />
avgIITex<br />
avgPITex<br />
avgPPTex<br />
avgBPTex<br />
avgTex</p>
<p>EXAMPLES<br />
Video and Audio grabbing</p>
<p>FFmpeg can use a video4linux compatible video source and any Open Sound System audio source:</p>
<p>ffmpeg /tmp/out.mpg</p>
<p>Note that you must activate the right video source and channel before launching FFmpeg with any TV viewer such as<br />
xawtv () by Gerd Knorr. You also have to set the audio recording levels correctly with<br />
a standard mixer.<br />
Video and Audio file format conversion</p>
<p>* FFmpeg can use any supported file format and protocol as input:</p>
<p>Examples:</p>
<p>* You can use YUV files as input:</p>
<p>ffmpeg -i /tmp/test%d.Y /tmp/out.mpg</p>
<p>It will use the files:</p>
<p>/tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,<br />
/tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc&#8230;</p>
<p>The Y files use twice the resolution of the U and V files. They are raw files, without header. They can be gener‐<br />
ated by all decent video decoders. You must specify the size of the image with the -s option if FFmpeg cannot<br />
guess it.</p>
<p>* You can input from a raw YUV420P file:</p>
<p>ffmpeg -i /tmp/test.yuv /tmp/out.avi</p>
<p>test.yuv is a file containing raw YUV planar data. Each frame is composed of the Y plane followed by the U and V<br />
planes at half vertical and horizontal resolution.</p>
<p>* You can output to a raw YUV420P file:</p>
<p>ffmpeg -i mydivx.avi hugefile.yuv</p>
<p>* You can set several input files and output files:</p>
<p>ffmpeg -i /tmp/a.wav -s 640&#215;480 -i /tmp/a.yuv /tmp/a.mpg</p>
<p>Converts the audio file a.wav and the raw YUV video file a.yuv to MPEG file a.mpg.</p>
<p>* You can also do audio and video conversions at the same time:<br />
* You can set several input files and output files:</p>
<p>ffmpeg -i /tmp/a.wav -s 640&#215;480 -i /tmp/a.yuv /tmp/a.mpg</p>
<p>Converts the audio file a.wav and the raw YUV video file a.yuv to MPEG file a.mpg.</p>
<p>* You can also do audio and video conversions at the same time:</p>
<p>ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2</p>
<p>Converts a.wav to MPEG audio at 22050Hz sample rate.</p>
<p>* You can encode to several formats at the same time and define a mapping from input stream to output streams:</p>
<p>ffmpeg -i /tmp/a.wav -ab 64 /tmp/a.mp2 -ab 128 /tmp/b.mp2 -map 0:0 -map 0:0</p>
<p>Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. ’-map file:index’ specifies which input stream is<br />
used for each output stream, in the order of the definition of output streams.</p>
<p>* You can transcode decrypted VOBs</p>
<p>ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800 -g 300 -bf 2 -acodec mp3 -ab 128 snatch.avi</p>
<p>This is a typical DVD ripping example; the input is a VOB file, the output an AVI file with MPEG-4 video and MP3<br />
audio. Note that in this command we use B-frames so the MPEG-4 stream is DivX5 compatible, and GOP size is 300<br />
which means one intra frame every 10 seconds for 29.97fps input video. Furthermore, the audio stream is<br />
MP3-encoded so you need to enable LAME support by passing &#8220;&#8211;enable-mp3lame&#8221; to configure.  The mapping is partic‐<br />
ularly useful for DVD transcoding to get the desired audio language.</p>
<p>NOTE: To see the supported input formats, use &#8220;ffmpeg -formats&#8221;.</p>
<p>SEE ALSO<br />
ffserver(1), ffplay(1) and the HTML documentation of ffmpeg.</p>
<p>AUTHOR Fabrice Bellard 2007-01-28</p>

<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>]]></content:encoded>
			<wfw:commentRss>http://www.webologist.co.uk/2008/03/converting-mpg-to-flv-using-ffmpeg.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
