PDA

View Full Version : How to mux H.264 video and MP3/AAC audio in to FLV for playing online ?


St Devious
15th June 2009, 00:32
Blip.tv (http://blip.tv/) allows the users to play the source material as it was uploaded.

I uploaded some H.264/AAC in MP4 material to it and tried playing the source file, but the quicktime player doesn't provide many options like a seekbar or fullscreen.

I was thinking maybe it would be better if I uploaded a flv file containing H.264 and MP3 or AAC streams to it so that it plays with the site's flash player.

Is this possible ? If so How do I mux the H.264 and MP3 or AAC stream into a FLV file ?

benwaggoner
15th June 2009, 01:51
H.264/AAC for Flash should use a normal MPEG-4 container and a .f4v extension. FLV should be H.263 or VP3 only.

St Devious
15th June 2009, 02:53
actually I figured it out and it is possible.

Used this peach of a software called SUPER to encode the source video to FLV container using H.264 and AAC. It only allowed a maximum of 3600 KBps bitrate for video, but that is enough for my purposes.

Here are the settings
http://i43.tinypic.com/swqpg4.jpg

Turned out pretty good. Here is the mediainfo on the resulting file

Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L5.1
Format settings, CABAC : Yes
Format settings, ReFrames : 5 frames
Muxing mode : Container profile=Unknown@5.1
Duration : 49s 920ms
Bit rate : 3 751 Kbps
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16/9
Frame rate : 25.000 fps
Resolution : 24 bits
Colorimetry : 4:2:0
Scan type : Progressive
Bits/(Pixel*Frame) : 0.163
Stream size : 22.3 MiB (98%)



The best news is that now I can have quality I encode to streamed on Web.

Here is an example of 3.7 MBps stream in original quality

http://blip.tv/file/2240946

and here is the one in 2Mbps which should be the same bitrate as Youtube HD but better quality.

http://blip.tv/file/2241131

And for comparison purposes here is Youtube HD

http://www.youtube.com/watch?v=MOgEGWY_9u4

roozhou
15th June 2009, 12:05
Use ffmpeg, try something like

ffmpeg -i h264_aac.mp4 -vcodec copy -acodec copy h264_aac.flv

LoRd_MuldeR
15th June 2009, 18:15
H.264/AAC for Flash should use a normal MPEG-4 container and a .f4v extension. FLV should be H.263 or VP3 only.

Why use yet another extension? The one and only "official" extension for MP4 files is ".mp4". There is enough confusion around ".m4a" and friends already :rolleyes:

ronnylov
26th June 2009, 14:36
So you could just change the extention from .mp4 to .f4v and it should be played by the flash player without any recompression made by blip.tv if the file is uploaded to blip.tv? Anybody tested this?

St Devious
26th June 2009, 15:11
So you could just change the extention from .mp4 to .f4v and it should be played by the flash player without any recompression made by blip.tv if the file is uploaded to blip.tv? Anybody tested this?

don't know about .f4v, but i have been doing this with flv. check the article in my sig

ronnylov
30th June 2009, 17:29
renaming the .mp4 file (created with MeGUI) to .f4v did not work on blip.tv, it rejected the upload as unsupported format.
But remuxing to .flv using the ffmpeg command above did work.
I did also add metadata into the .flv file since ffmpeg does not do it, but I have not tested if it really was necessary.
I used "flvtool2 -U FLV_FILE.FLV" to insert metadata.
Thanks for your guide St Devious!

However I get buffering problems with bitrates above ~1500 kbit/s on blip.tv so I can still not get better quality than YouTubeHD without having to pause to fill the buffer before playing. I guess my internet connection is too slow... But it is nice that I can optimize my encodings myself to something good within this available bitrate range (I probably will use around 1000 kbit/s average and lower resolution like 640x360).

thangkhungpro
7th July 2009, 20:47
You can use ffmpeg to mux it ;) , I mux it by encoding to FLV H264/mp3 (aac) .

Try this command

C:\Documents and Settings\Phuong>"D:\SOFT\Studio Soft\Convert-Rip Tool\Rip DVD\ffmpeg.exe" -i "E:\Converted\33.wmv" -vcodec libx264 -vb 350000 -acodec libmp3lame -ab 64000 -ar 44100 -f flv -y "E:\Converted\33.flv"


I'm not good at enlish , some thing i can say :D

Dark Shikari
7th July 2009, 20:48
You can use ffmpeg to mux it ;) , I mux it by encoding to FLV H264/mp3 (aac) .

Try this command

C:\Documents and Settings\Phuong>"D:\SOFT\Studio Soft\Convert-Rip Tool\Rip DVD\ffmpeg.exe" -i "E:\Converted\33.wmv" -vcodec libx264 -vb 350000 -acodec libmp3lame -ab 64000 -ar 44100 -f flv -y "E:\Converted\33.flv"


I'm not good at enlish , some thing i can say :DNever, ever encode with ffmpeg and libx264 without using presets. (http://rob.opendot.cl/index.php/useful-stuff/ffmpeg-x264-encoding-guide/)

SeeMoreDigital
7th July 2009, 23:12
don't know about .f4v, but i have been doing this with flv. check the article in my sigYep... me to ;)

thangkhungpro
8th July 2009, 07:39
It's Simple Command , use can add more .

:D audio codec : mp3 , you can replace aac ;)

C:\Documents and Settings\Phuong>"D:\SOFT\Studio Soft\Convert-Rip Tool\Rip DVD\ffmpeg.exe" -i "E:\Converted\33.wmv" -vcodec libx264 -vb 350000 -acodec libmp3lame -ab 64000 -ar 44100 -f flv -y "E:\Converted\33.flv"


I tested , and it's can playback on my player . mkv , avi , mp4 , FLV ,. .... all supported . FLV x264 aac(mp3) . You can test it .

St Devious
18th July 2009, 02:18
Use ffmpeg, try something like

ffmpeg -i h264_aac.mp4 -vcodec copy -acodec copy h264_aac.flv

You can use ffmpeg to mux it ;) , I mux it by encoding to FLV H264/mp3 (aac) .

Try this command

C:\Documents and Settings\Phuong>"D:\SOFT\Studio Soft\Convert-Rip Tool\Rip DVD\ffmpeg.exe" -i "E:\Converted\33.wmv" -vcodec libx264 -vb 350000 -acodec libmp3lame -ab 64000 -ar 44100 -f flv -y "E:\Converted\33.flv"




Thanks, works perfectly. Even lets me bypass the 3600 Kbps limit that SUPER has.