encode to h264 (flash support)
Hello all, after recent flash player update http://www.adobe.com/devnet/flashplayer/articles/hd_video_flash_player.html http://labs.adobe.com/wiki/index.php/Flash_Player:9:Update:H.264 I am trying using mencoder to encode video to h264 and audio to aac. Firt, I am working with video, so I want make be sure, audio is not problem. I am using this command: mencoder amy1.flv -oac mp3lame -srate 44100 -lameopts \ vbr=2:q=8:aq=0:mode=1:lowpassfreq=16000 -ovc x264 -x264encopts \ threads=auto:subq=5:partitions=4x4:8x8dct:frameref=3:me=hex:bframes=4:b_pyramid:psnr:bitrate=348\ -of lavf -lavfopts format=mov -o amy1.mp4 I am doing certainly something wrong. I downloaded youtube mp4 and analyze it a little bit, here are main differencies between my and youtube mp4, which plays in flash: YOUTUBE mp4: Playing video.mp4. ISO: File Type Major Brand: ISO/IEC 14496-1 (MPEG-4 system) v2 Quicktime/MOV file format detected. ID_AUDIO_ID=0 [mov] Audio stream found, -aid 0 ID_VIDEO_ID=1 [mov] Video stream found, -vid 1 VIDEO: [avc1] 320x240 24bpp 15.000 fps 0.0 kbps ( 0.0 kbyte/s) ID_FILENAME=video.mp4 ID_DEMUXER=mov ID_VIDEO_FORMAT=avc1 ID_VIDEO_BITRATE=0 ID_VIDEO_WIDTH=320 ID_VIDEO_HEIGHT=240 ID_VIDEO_FPS=15.000 ID_VIDEO_ASPECT=0.0000 ID_AUDIO_FORMAT=mp4a ID_AUDIO_BITRATE=99896 ID_AUDIO_RATE=44100 ID_AUDIO_NCH=2 ID_LENGTH=75.33 ========================================================================== Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264) ========================================================================== ID_VIDEO_CODEC=ffh264 ========================================================================== Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding) AUDIO: 44100 Hz, 2 ch, s16le, 99.9 kbit/7.08% (ratio: 12487->176400) ID_AUDIO_BITRATE=99896 ID_AUDIO_RATE=44100 ID_AUDIO_NCH=2 Selected audio codec: [faad] afm: faad (FAAD AAC (MPEG-2/MPEG-4 Audio) decoder) ========================================================================== AO: [dsound] 44100Hz 2ch s16le (2 bytes per sample) ID_AUDIO_CODEC=faad Starting playback... =============================================================================== ISO: File Type Major Brand: Original QuickTime Quicktime/MOV file format detected. ID_VIDEO_ID=0 [mov] Video stream found, -vid 0 ID_AUDIO_ID=1 [mov] Audio stream found, -aid 1 VIDEO: [avc1] 512x384 24bpp 29.970 fps 0.0 kbps ( 0.0 kbyte/s) ID_FILENAME=amy1.mp4 ID_DEMUXER=mov ID_VIDEO_FORMAT=avc1 ID_VIDEO_BITRATE=0 ID_VIDEO_WIDTH=512 ID_VIDEO_HEIGHT=384 ID_VIDEO_FPS=29.970 ID_VIDEO_ASPECT=0.0000 ID_AUDIO_FORMAT=.mp3 ID_AUDIO_BITRATE=0 ID_AUDIO_RATE=44100 ID_AUDIO_NCH=2 ID_LENGTH=115.55 ========================================================================== Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264) ========================================================================== ID_VIDEO_CODEC=ffh264 ========================================================================== Opening audio decoder: [mp3lib] MPEG layer-2, layer-3 AUDIO: 44100 Hz, 2 ch, s16le, 40.0 kbit/2.83% (ratio: 5000->176400) ID_AUDIO_BITRATE=40000 ID_AUDIO_RATE=44100 ID_AUDIO_NCH=2 Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3) ========================================================================== AO: [dsound] 44100Hz 2ch s16le (2 bytes per sample) ID_AUDIO_CODEC=mp3 Starting playback... from my point problem is with different ISO, but I don't know how to put h264 in mov cointainter properly. Any hint please ? Thank you very much /Brano
On Monday 03 March 2008 11:40, Ing. Branislav Gerzo wrote:
Hello all,
after recent flash player update http://www.adobe.com/devnet/flashplayer/articles/hd_video_flash_player.html http://labs.adobe.com/wiki/index.php/Flash_Player:9:Update:H.264
I am trying using mencoder to encode video to h264 and audio to aac. Firt, I am working with video, so I want make be sure, audio is not problem.
I am using this command: mencoder amy1.flv -oac mp3lame -srate 44100 -lameopts \ vbr=2:q=8:aq=0:mode=1:lowpassfreq=16000 -ovc x264 -x264encopts \ threads=auto:subq=5:partitions=4x4:8x8dct:frameref=3:me=hex:bframes=4:b_pyr amid:psnr:bitrate=348\ -of lavf -lavfopts format=mov -o amy1.mp4
mencoder generates broken files when used with the lavf muxer and b-frames. If you want to use b-frames, then encode to AVI using the standard way (don't use lavf) and then use MP4Box to remux the AVI into the MP4 container MP4Box -aviraw video file.avi MP4Box -aviraw audio file.avi mv *.raw audio.aac MP4Box -add *.h264 -add *.aac output.mp4
I am doing certainly something wrong. I downloaded youtube mp4 and analyze it a little bit, here are main differencies between my and youtube mp4, which plays in flash:
YOUTUBE mp4:
Playing video.mp4. ISO: File Type Major Brand: ISO/IEC 14496-1 (MPEG-4 system) v2 Quicktime/MOV file format detected. ID_AUDIO_ID=0 [mov] Audio stream found, -aid 0 ID_VIDEO_ID=1 [mov] Video stream found, -vid 1 VIDEO: [avc1] 320x240 24bpp 15.000 fps 0.0 kbps ( 0.0 kbyte/s) ID_FILENAME=video.mp4 ID_DEMUXER=mov ID_VIDEO_FORMAT=avc1 ID_VIDEO_BITRATE=0 ID_VIDEO_WIDTH=320 ID_VIDEO_HEIGHT=240 ID_VIDEO_FPS=15.000 ID_VIDEO_ASPECT=0.0000 ID_AUDIO_FORMAT=mp4a ID_AUDIO_BITRATE=99896 ID_AUDIO_RATE=44100 ID_AUDIO_NCH=2 ID_LENGTH=75.33 ========================================================================== Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264) ========================================================================== ID_VIDEO_CODEC=ffh264 ========================================================================== Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding) AUDIO: 44100 Hz, 2 ch, s16le, 99.9 kbit/7.08% (ratio: 12487->176400) ID_AUDIO_BITRATE=99896 ID_AUDIO_RATE=44100 ID_AUDIO_NCH=2 Selected audio codec: [faad] afm: faad (FAAD AAC (MPEG-2/MPEG-4 Audio) decoder) ========================================================================== AO: [dsound] 44100Hz 2ch s16le (2 bytes per sample) ID_AUDIO_CODEC=faad Starting playback... =========================================================================== ====
ISO: File Type Major Brand: Original QuickTime Quicktime/MOV file format detected. ID_VIDEO_ID=0 [mov] Video stream found, -vid 0 ID_AUDIO_ID=1 [mov] Audio stream found, -aid 1 VIDEO: [avc1] 512x384 24bpp 29.970 fps 0.0 kbps ( 0.0 kbyte/s) ID_FILENAME=amy1.mp4 ID_DEMUXER=mov ID_VIDEO_FORMAT=avc1 ID_VIDEO_BITRATE=0 ID_VIDEO_WIDTH=512 ID_VIDEO_HEIGHT=384 ID_VIDEO_FPS=29.970 ID_VIDEO_ASPECT=0.0000 ID_AUDIO_FORMAT=.mp3 ID_AUDIO_BITRATE=0 ID_AUDIO_RATE=44100 ID_AUDIO_NCH=2 ID_LENGTH=115.55 ========================================================================== Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264) ========================================================================== ID_VIDEO_CODEC=ffh264 ========================================================================== Opening audio decoder: [mp3lib] MPEG layer-2, layer-3 AUDIO: 44100 Hz, 2 ch, s16le, 40.0 kbit/2.83% (ratio: 5000->176400) ID_AUDIO_BITRATE=40000 ID_AUDIO_RATE=44100 ID_AUDIO_NCH=2 Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3) ========================================================================== AO: [dsound] 44100Hz 2ch s16le (2 bytes per sample) ID_AUDIO_CODEC=mp3 Starting playback...
from my point problem is with different ISO, but I don't know how to put h264 in mov cointainter properly. Any hint please ?
Thank you very much
/Brano _______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
-- Regards
GN> mencoder generates broken files when used with the lavf muxer and b-frames. If I see. is there some workaround for this (except using other programs, if possible)? I think not using b-frames in h.264 is not good idea. Or I will wait for some next release of mencoder, where it will be fixed? GN> you want to use b-frames, then encode to AVI using the standard way (don't GN> use lavf) and then use MP4Box to remux the AVI into the MP4 container yes, this worked quite OK (I get A/V sync errors...), so in other words I _have_ to use mp4box if I want h.264 with b-frames, right ? also for encoding HE-AAC I can use mencoder using faac, or I have use neroAacEnc? Thank you. /Brano
On Monday 03 March 2008 13:33, Ing. Branislav Gerzo wrote:
GN> mencoder generates broken files when used with the lavf muxer and b-frames. If
I see. is there some workaround for this (except using other programs, if possible)? I think not using b-frames in h.264 is not good idea. Or I will wait for some next release of mencoder, where it will be fixed?
not at the moment, this won't be fixed any time soon. If you want to directly output to h264+b-frames MP4 then use ffmpeg, not mencoder
GN> you want to use b-frames, then encode to AVI using the standard way (don't GN> use lavf) and then use MP4Box to remux the AVI into the MP4 container
yes, this worked quite OK (I get A/V sync errors...), so in other words I _have_ to use mp4box if I want h.264 with b-frames, right ?
no, see above, you can use ffmpeg which does proper muxing you get A/V sync errors because you have to append the harddup video filter at the end of the filter chain
also for encoding HE-AAC I can use mencoder using faac, or I have use neroAacEnc?
mencoder/faac don't support yet HE-AAC, so you have to use neroAacEnc or aacplusenc http://teknoraver.campuslife.it/software/mp4tools/aacplusenc-0.16.3.tar.bz2
Thank you.
/Brano _______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
-- Regards
GN> not at the moment, this won't be fixed any time soon. If you want to directly GN> output to h264+b-frames MP4 then use ffmpeg, not mencoder thanks for honest answer, it seems I have to try ffmpeg, maybe it also supports HE-AAC encoding :) I don't like many tools installed on system, using pipes to get best results... I am sure ffmpeg has own flaws too, we will see. Thank you again. /Brano
On Mon, Mar 03, 2008 at 01:39:14PM +0100, Grozdan Nikolov (openSUSE Linux) wrote:
On Monday 03 March 2008 13:33, Ing. Branislav Gerzo wrote:
GN> mencoder generates broken files when used with the lavf muxer and b-frames. If
I see. is there some workaround for this (except using other programs, if possible)? I think not using b-frames in h.264 is not good idea. Or I will wait for some next release of mencoder, where it will be fixed?
not at the moment, this won't be fixed any time soon. If you want to directly output to h264+b-frames MP4 then use ffmpeg, not mencoder
(being a newbie to encoding), why would you suggest ffmpeg and not x264 to do the encoding. I recently went through the process of trying to encode some avi files, that would not play with mplayer or mencoder (it would bomb out), I had to use transcode with import lav not ffmpeg (just realised i could have probably done the same with mencoder) export to yuv4mpeg and then process with x264, process the audio and then merge back together with MP4Box Is there any time frame on when mencoder will be able to handle mp4 files directly ?
GN> you want to use b-frames, then encode to AVI using the standard way (don't GN> use lavf) and then use MP4Box to remux the AVI into the MP4 container
yes, this worked quite OK (I get A/V sync errors...), so in other words I _have_ to use mp4box if I want h.264 with b-frames, right ?
no, see above, you can use ffmpeg which does proper muxing
you get A/V sync errors because you have to append the harddup video filter at the end of the filter chain
also for encoding HE-AAC I can use mencoder using faac, or I have use neroAacEnc?
mencoder/faac don't support yet HE-AAC, so you have to use neroAacEnc or aacplusenc
http://teknoraver.campuslife.it/software/mp4tools/aacplusenc-0.16.3.tar.bz2
Thank you.
/Brano _______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
-- Regards _______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
-- "If you're sick and tired of the politics of cynicism and polls and principles, come and join this campaign." - George W. Bush 02/16/2000 Hilton Head, S.C.
On Monday 03 March 2008 20:35, Alex Samad wrote:
On Mon, Mar 03, 2008 at 01:39:14PM +0100, Grozdan Nikolov (openSUSE Linux) wrote:
On Monday 03 March 2008 13:33, Ing. Branislav Gerzo wrote:
GN> mencoder generates broken files when used with the lavf muxer and b-frames. If
I see. is there some workaround for this (except using other programs, if possible)? I think not using b-frames in h.264 is not good idea. Or I will wait for some next release of mencoder, where it will be fixed?
not at the moment, this won't be fixed any time soon. If you want to directly output to h264+b-frames MP4 then use ffmpeg, not mencoder
(being a newbie to encoding), why would you suggest ffmpeg and not x264 to do the encoding.
I don't know, it was the first thing that popped into my mind. :) x264 is perfectly fine too but it only accepts raw yuv sources and must be compiled with gpac support for mp4 output
I recently went through the process of trying to encode some avi files, that would not play with mplayer or mencoder (it would bomb out), I had to use transcode with import lav not ffmpeg (just realised i could have probably done the same with mencoder) export to yuv4mpeg and then process with x264, process the audio and then merge back together with MP4Box
Is there any time frame on when mencoder will be able to handle mp4 files directly ?
mencoder already handles mp4's just fine, if you don't use b-frames that is. I'm no mencoder expert/coder but I think someone just needs to rewrite mencoder.c and add proper lavc support into it... fix the damn timestamps :)
GN> you want to use b-frames, then encode to AVI using the standard way (don't GN> use lavf) and then use MP4Box to remux the AVI into the MP4 container
yes, this worked quite OK (I get A/V sync errors...), so in other words I _have_ to use mp4box if I want h.264 with b-frames, right ?
no, see above, you can use ffmpeg which does proper muxing
you get A/V sync errors because you have to append the harddup video filter at the end of the filter chain
also for encoding HE-AAC I can use mencoder using faac, or I have use neroAacEnc?
mencoder/faac don't support yet HE-AAC, so you have to use neroAacEnc or aacplusenc
http://teknoraver.campuslife.it/software/mp4tools/aacplusenc-0.16.3.tar.b z2
Thank you.
/Brano _______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
-- Regards _______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
-- Regards
On Mon, Mar 03, 2008 at 08:40:42PM +0100, Grozdan Nikolov (openSUSE Linux) wrote:
On Monday 03 March 2008 20:35, Alex Samad wrote:
On Mon, Mar 03, 2008 at 01:39:14PM +0100, Grozdan Nikolov (openSUSE Linux) wrote:
On Monday 03 March 2008 13:33, Ing. Branislav Gerzo wrote:
GN> mencoder generates broken files when used with the lavf muxer and b-frames. If
I see. is there some workaround for this (except using other programs, if possible)? I think not using b-frames in h.264 is not good idea. Or I will wait for some next release of mencoder, where it will be fixed?
not at the moment, this won't be fixed any time soon. If you want to directly output to h264+b-frames MP4 then use ffmpeg, not mencoder
(being a newbie to encoding), why would you suggest ffmpeg and not x264 to do the encoding.
I don't know, it was the first thing that popped into my mind. :) x264 is perfectly fine too but it only accepts raw yuv sources and must be compiled with gpac support for mp4 output yep, which is why I had to go to transcode. I use this on debian so it is a simple apt-get install...
What bugs me about making x264 in avi containers and then moving them to mp4 containers is why move them over to mp4, if it is for better support of h264, then isn't something lost by creating them in avi containers and if you can create that on the fly with tools like MP4Box, why don't players do that instead of having to pre encode (I am probably missing something obvious to the experienced pro, like I said I am a weekend cowboy when it come to encoding)
I recently went through the process of trying to encode some avi files, that would not play with mplayer or mencoder (it would bomb out), I had to use transcode with import lav not ffmpeg (just realised i could have probably done the same with mencoder) export to yuv4mpeg and then process with x264, process the audio and then merge back together with MP4Box
Is there any time frame on when mencoder will be able to handle mp4 files directly ?
mencoder already handles mp4's just fine, if you don't use b-frames that is. I'm no mencoder expert/coder but I think someone just needs to rewrite mencoder.c and add proper lavc support into it... fix the damn timestamps :)
GN> you want to use b-frames, then encode to AVI using the standard way (don't GN> use lavf) and then use MP4Box to remux the AVI into the MP4 container
yes, this worked quite OK (I get A/V sync errors...), so in other words I _have_ to use mp4box if I want h.264 with b-frames, right ?
no, see above, you can use ffmpeg which does proper muxing
you get A/V sync errors because you have to append the harddup video filter at the end of the filter chain
also for encoding HE-AAC I can use mencoder using faac, or I have use neroAacEnc?
mencoder/faac don't support yet HE-AAC, so you have to use neroAacEnc or aacplusenc
http://teknoraver.campuslife.it/software/mp4tools/aacplusenc-0.16.3.tar.b z2
Thank you.
/Brano _______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
-- Regards _______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
-- Regards _______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
-- [Norm comes in with an attractive woman.] Coach: Normie, Normie, could this be Vera? Norm: With a lot of expensive surgery, maybe. -- Cheers, Norman's Conquest Coach: What's up, Normie? Norm: The temperature under my collar, Coach. -- Cheers, I'll Be Seeing You (Part 2) Coach: What would you say to a nice beer, Normie? Norm: Going down? -- Cheers, Diane Meets Mom
On Monday 03 March 2008 20:47, Alex Samad wrote:
On Mon, Mar 03, 2008 at 08:40:42PM +0100, Grozdan Nikolov (openSUSE Linux) wrote:
On Monday 03 March 2008 20:35, Alex Samad wrote:
On Mon, Mar 03, 2008 at 01:39:14PM +0100, Grozdan Nikolov (openSUSE Linux)
wrote:
On Monday 03 March 2008 13:33, Ing. Branislav Gerzo wrote:
GN> mencoder generates broken files when used with the lavf muxer and b-frames. If
I see. is there some workaround for this (except using other programs, if possible)? I think not using b-frames in h.264 is not good idea. Or I will wait for some next release of mencoder, where it will be fixed?
not at the moment, this won't be fixed any time soon. If you want to directly output to h264+b-frames MP4 then use ffmpeg, not mencoder
(being a newbie to encoding), why would you suggest ffmpeg and not x264 to do the encoding.
I don't know, it was the first thing that popped into my mind. :) x264 is perfectly fine too but it only accepts raw yuv sources and must be compiled with gpac support for mp4 output
yep, which is why I had to go to transcode. I use this on debian so it is a simple apt-get install...
What bugs me about making x264 in avi containers and then moving them to mp4 containers is why move them over to mp4, if it is for better support of h264, then isn't something lost by creating them in avi containers and if you can create that on the fly with tools like MP4Box, why don't players do that instead of having to pre encode (I am probably missing something obvious to the experienced pro, like I said I am a weekend cowboy when it come to encoding)
the thing with AVI is that it wasn't designed to use multiple frame references and can't "see" that far when you go above 8 framerefs. Also AVI wasn't designed to handle out of order frames and b-frames as well. AVI is a simple and limited container which is out of this century (here limited doesn't mean the amount of audio/video codecs it can support rather which features it can support of modern codecs). AVI also has a huge overhead compared to mp4 or matroska. I'm sure MEncoder uses nasty hacks to allow more than 8 frame references and b-frames/out of order/packed frames
I recently went through the process of trying to encode some avi files, that would not play with mplayer or mencoder (it would bomb out), I had to use transcode with import lav not ffmpeg (just realised i could have probably done the same with mencoder) export to yuv4mpeg and then process with x264, process the audio and then merge back together with MP4Box
Is there any time frame on when mencoder will be able to handle mp4 files directly ?
mencoder already handles mp4's just fine, if you don't use b-frames that is. I'm no mencoder expert/coder but I think someone just needs to rewrite mencoder.c and add proper lavc support into it... fix the damn timestamps :)
GN> you want to use b-frames, then encode to AVI using the standard way (don't GN> use lavf) and then use MP4Box to remux the AVI into the MP4 container
yes, this worked quite OK (I get A/V sync errors...), so in other words I _have_ to use mp4box if I want h.264 with b-frames, right ?
no, see above, you can use ffmpeg which does proper muxing
you get A/V sync errors because you have to append the harddup video filter at the end of the filter chain
also for encoding HE-AAC I can use mencoder using faac, or I have use neroAacEnc?
mencoder/faac don't support yet HE-AAC, so you have to use neroAacEnc or aacplusenc
http://teknoraver.campuslife.it/software/mp4tools/aacplusenc-0.16.3.t ar.b z2
Thank you.
/Brano _______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
-- Regards _______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
-- Regards _______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
-- Regards
On Tue, 4 Mar 2008 06:47:23 +1100 Alex Samad <alex@samad.com.au> wrote:
isn't something lost by creating them in avi containers
Not at all.
and if you can create that on the fly with tools like MP4Box, why don't players do that instead of having to pre encode
Because MOV (MP4 is a subset) is one of the most complex container formats around, and AVI is much older and more popular than MP4. Creating proper MP4 files isn't trivial, and mencoder in particular isn't well-suited to output anything but AVI.
participants (4)
-
Alex Samad -
Grozdan Nikolov (openSUSE Linux) -
Ing. Branislav Gerzo -
RC