Please avoid top-posting on this list. On Thu, 2010-11-11 at 17:39 +0800, cheng chen wrote: > 2010/11/10 Tomas Härdin <[email protected]> > > > On Wed, 2010-11-10 at 11:31 +0800, cheng chen wrote: > > > Hi,all > > > I am try to use hardware to decode the stream of "mpeg4/h264/vc1/h263". > > > Since I just want to get the stream out of the video container, no > > further > > > decode, I find that in struct AVStream there is an element call "int > > > stream_copy" and I find several > > > av_encode()<http://ffmpeg.org/doxygen/0.5/ffmpeg_8c-source.html#l01548> > > > , new_video_stream()< > > http://ffmpeg.org/doxygen/0.5/ffmpeg_8c-source.html#l02984> > > > , print_report()< > > http://ffmpeg.org/doxygen/0.5/ffmpeg_8c-source.html#l01051>, > > > and read_ffserver_streams()< > > http://ffmpeg.org/doxygen/0.5/ffmpeg_8c-source.html#l00442>. > > > functions. But I have no idea which function should I use. > > > Can anyone give any suggestions? Thx! > > > > Just open the file using av_open_input_file() and av_find_stream_info(), > > then read packets using av_read_frame(). Just check stream_index of the > > packets to get the video ones. > > > > /Tomas > > > > Thank for your answer. I just tried what you have said for several times. > But the result seems really odd. > when my input file is a "ED_1024.avi: RIFF (little-endian) data, AVI" file, > I demux it into video file and a audio file. > ED: MPEG sequence, v4, video, simple @ L1 > EDD: ATSC A/52 aka AC-3 aka Dolby Digital stream, 48 kHz,, complete main > (CM) 3 front/2 rear, LFE on,, 448 kbit/s reserved Dolby Surround mode > > That is just what I want. > > But when this come to a .mp4 file: > > "1.mp4: ISO Media, MPEG v4 system, version 2" which also contain the same > mpeg4 and audio. > Seems stream 0 codec frame rate differs from container frame rate: 30000.00 > (30000/1) -> 15.00 (15/1) > Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1.mp4': > Metadata: > major_brand : mp42 > minor_version : 0 > compatible_brands: mp423gp4isom > Duration: 00:02:57.63, start: 0.000000, bitrate: 813 kb/s > Stream #0.0(und): Video: mpeg4, yuv420p, 352x288 [PAR 1:1 DAR 11:9], 763 > kb/s, 13.50 fps, 15 tbr, 30k tbn, 30k tbc > Stream #0.1(und): Audio: aac, 16000 Hz, mono, s16, 48 kb/s > > > The video become(not a video any more): > "1.mpeg4: data " using file command under linux > and > "Input #0, mp3, from '1.mpeg4': > Duration: 00:28:15.50, start: 0.000000, bitrate: 80 kb/s > Stream #0.0: Audio: mp2, 24000 Hz, 2 channels, s16, 80 kb/s" > with ffmpeg -i 1.mp4 > > I don't understand what's the difference. Thx.
So you're dumping the data as is to files? You probably want to mux them in some kind of container unless you know what you're doing. I'm not sure if mpeg4 data can be dumped as is. For comparison, h264 can be dumped like that, if NAL units are formatted correctly. aac too if I understand correctly (though its data is not required to be aligned at byte boundaries). Similarly with mpeg2. I suggest looking at how ffmpeg.c handles -acodec copy and -vcodec copy. /Tomas
signature.asc
Description: This is a digitally signed message part
_______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
