直接播放H264视频流的方法或工具

上一篇 / 下一篇  2013-07-31 10:29:21 / 个人分类:工具

   版权信息: 可以任意转载, 转载时请务必以超链接形式标明文章原文出处, 即下面的声明.

)BP!X7~[ ?A0
前几天在查找资料的时候发现一篇文章特别实用,链接如下:
   http://blog.csdn.net/jasonhwang/article/details/7359095
&P6C:cqhZ PXH0抓取一个包含H.264 Payload RTP包的SIP会话或RTSP会话后,用Wireshark的Play功能只能播放声音,不能播放视频。把payload直接导出成文件后也是不能直接播放的,因为H.264 over RTP封包是符合RFC3984规范的,必须按照该规范把H.264数据取出来后,组成NALU,放到avi/mp4或裸码流文件等容器里后才能播放。51Testing软件测试网L|?_p2J

     本人写了一个wireshark插件,可以在打开包含H.264码流的抓包后,选菜单“Tools->Export H264 to file [HQX's plugins]”后,把抓包文件里的H.264码流自动导出到抓包文件所在目录(工作目录)里,名为from_<RTP流源 ip>_<RTP流源端口>_to_<RTP流目的ip>_<RTP流目的端口>.264的264裸码流文件 里。(文件格式为每个NALU前加0x00000001分隔符)。

%i)w&K Gg4ak2K&`0

^Sq*e;k[SgWs0      本程序可以识别RFC3984里提到的三种H.264 over RTP封装,分别是Single NALU(一个RTP含一个NALU)、STAP-A(一个RTP包含多个NALU)、FU-A(一个NALU分布到多个RTP包)三种封装格式,且会自 动把SPS和PPS放到裸码流文件头部。51Testing软件测试网t.bY\$G%\w

51Testing软件测试网0}'SRUQ%Nj2QZ

Lua脚本如下:51Testing软件测试网 S;^1Z]n

1ph*p^$@.X*ws051Testing软件测试网%D bL*T2^g
51Testing软件测试网MJ2IZ ^i V

6]!n3R V^DH2^.S:E[l0-- Dump RTP h.264 payload to raw h.264 file (*.264)51Testing软件测试网R(i;R#t!KzZ

51Testing软件测试网#v0Ya+d!j|

-- According to RFC3984 to dissector H264 payload of RTP to NALU, and write it51Testing软件测试网DpVGn P

xvq `dr0-- to from<sourceIp_sourcePort>to<dstIp_dstPort>.264 file. By now, we support single NALU,

HM(v+e3r#d*c\8S051Testing软件测试网{;m"KJ/_*{

-- STAP-A and FU-A format RTP payload for H.264.51Testing软件测试网'Y(bpo i MA

51Testing软件测试网aZ N(Zhi\

-- You can access this feature by menu "Tools->Export H264 to file [HQX's plugins]"

f(FA%}bH0

{J'qX,GNps'EG)P0-- Author: Huang Qiangxiong (qiangxiong.huang@gmail.com)

i M"d8z"u8BkB"D051Testing软件测试网B:b ]yUW

-- change log:

#Q@{u8r6KM0

A*i3K1bC cy0--      2012-03-13

z@3tx!RG _/a8n j0

fRm:sk0--          Just can play

k}BBy6xT` |051Testing软件测试网9j LD~!NZ8m*b X!U

------------------------------------------------------------------------------------------------51Testing软件测试网%G}B e5Y C'zH

51Testing软件测试网:D#[D }BY/k

do

9lH%l#|ZF$yt051Testing软件测试网*npa$I#^L

    -- for geting h264 data (the field's value is type of ByteArray)51Testing软件测试网 k9o)l)M4et(^kz;e

51Testing软件测试网sv,o*pY r6FF#GR

    local f_h264 = Field.new("h264") 

:^_%K%{/Kv1nY051Testing软件测试网0r*W4{F'hV\*vub6~

51Testing软件测试网)V N:o+M1h*W9j
51Testing软件测试网|plQ X

51Testing软件测试网}9TEB2ARK%{ `z

    -- menu action. When you click "Tools->Export H264 to file [HQX's plugins]" will run this function51Testing软件测试网 I6OK8g%S\(dR w

WP%G_x D L0    local function export_h264_to_file()

~h6k8~i}Y]051Testing软件测试网O _C2B gMG&u1E8B

        -- window for showing information51Testing软件测试网+i3kf;{H*Ug

KO Fz HT0        local tw = TextWindow.new("Export H264 to File Info Win")51Testing软件测试网9qSsl'a3UG(H q'j

51Testing软件测试网BE _Ft*P

        local pgtw = ProgDlg.new("Export H264 to File Process", "Dumping H264 data to file...")

1Po*K COH{Y}051Testing软件测试网'Y,Sl;A{O

        

$d!V,r9rw~#J0

#a~W:S;{ wu0        -- add message to information window51Testing软件测试网+pE(|qpS8V4`z

-Ev9O5Y&N.k.D0        function twappend(str)51Testing软件测试网-[O5epm7A9e

51Testing软件测试网}j ]?[7TT

            tw:append(str)51Testing软件测试网7c i dgP$cQ*~6[7C uv

51Testing软件测试网V3L2m ~n+ZQ#A

            tw:append("\n")

t.W7q4D G0

8lpp;]B k0        end

[Mlk^F'x0

}h6Aa+K*^X ~0        51Testing软件测试网-n;k3gQ1AN*c

51Testing软件测试网!X0[fZgP ^:f6j

        -- running first time for counting and finding sps+pps, second time for real saving51Testing软件测试网__J9\q.}z

_R2[{2l0        local first_run = true 

i$i c`0`u0

$DuFrJy0        -- variable for storing rtp stream and dumping parameters

.rE O&X E W"A,m C0KM0

c{CM!v2P nPO g0        local stream_infos = {}51Testing软件测试网cqn+c o;i

51Testing软件测试网z,Y$Q"x~,{

51Testing软件测试网l^m~SxDH!]

3JlL.U {:p|G0

q[Tl5v\0        -- trigered by all h264 packats51Testing软件测试网w^ kA/U}s

6EKnK*_f*Y0        local my_h264_tap = Listener.new(tap, "h264")

N1Z*Dpc^!Z h Aw051Testing软件测试网#uj"f[eWe;F^

        51Testing软件测试网!f7iLo?rH4uRg;q

T#ec.a'R!Z)w'E0        -- get rtp stream info by src and dst address51Testing软件测试网^TF/`'H\b

51Testing软件测试网9s:aY/] V

        function get_stream_info(pinfo)

v-D.Y?,qX S-s7e051Testing软件测试网Wo Lno(}BTcD,V9k

            local key = "from_" .. tostring(pinfo.src) .. "_" .. tostring(pinfo.src_port) .. "to" .. tostring(pinfo.dst) .. "_" .. tostring(pinfo.dst_port)

c8[ i'`6m }EFw`7\0

#Lg h_8H&{&^/S"AEx0            local stream_info = stream_infos[key]

2r:\p)w"A _8~&S8S4`2o051Testing软件测试网nV!h6w3Wr+ku)Gm

            if not stream_info then -- if not exists, create one

-]7N};o[9@o%e;MW0

1C!FF6Sp&lN0                stream_info = { }51Testing软件测试网8jNAk0d

51Testing软件测试网#V \El*|ol5}I

                stream_info.filename = key.. ".264"51Testing软件测试网n0^cH.E ksu

51Testing软件测试网s/Q:v }B

                stream_info.file = io.open(stream_info.filename, "wb")

m\e]0fE8]}0

.}au ?9ue0                stream_info.counter = 0 -- counting h264 total NALUs51Testing软件测试网)b{0i$N]&~&Kc

F r E]cS|\]+AQ0                stream_info.counter2 = 0 -- for second time running

sszW5nq0

8U+Ieu+P5w4SMM0                stream_infos[key] = stream_info51Testing软件测试网N nRs)z:F6r:Q

'n&X*~ P?0?0                twappend("Ready to export H.264 data (RTP from " .. tostring(pinfo.src) .. ":" .. tostring(pinfo.src_port) 

owr"G(y!a!_051Testing软件测试网C4v[zV7S"[T

                         .. " to " .. tostring(pinfo.dst) .. ":" .. tostring(pinfo.dst_port) .. " to file:\n         [" .. stream_info.filename .. "] ...\n")

u$h dkWVKM/D051Testing软件测试网)N:f"|.GJX;J@/m!p

            end51Testing软件测试网 T(]n {Wt

f0ekh!}/Q0            return stream_info51Testing软件测试网5d.U n|,KB6D6VH

jF+pT`0        end

%_9G I4t4ye051Testing软件测试网#cd+n'B~'XnH3R

        51Testing软件测试网3a~8JkyO

M*fiu!O@{ u0        -- write a NALU or part of NALU to file.

dE$n\+md&f[5T3@051Testing软件测试网Qp,XY:I2s4A

        function write_to_file(stream_info, str_bytes, begin_with_nalu_hdr)51Testing软件测试网*v0` a)R&P\

51Testing软件测试网y-j Ph]bV\~I

            if first_run then

VHNzl8i0

{!ZEF g1e W?0                stream_info.counter = stream_info.counter + 151Testing软件测试网,N:rzWI L:r%J6b

51Testing软件测试网9{'yXXS7|

                51Testing软件测试网 o_C wOu6ieQ.O

0x+SzXC+Q? c%e0                if begin_with_nalu_hdr then

U v|!E;u,bE$tle0y051Testing软件测试网"ZN5_FX @/P:Q

                    -- save SPS or PPS51Testing软件测试网%@(}i`(z'_-D+f

'K7e _ Ccu _0                    local nalu_type = bit.band(str_bytes:byte(0,1), 0x1F)

-iU Nn-N0

i(M4n,G&zfV Be1e0                    if not stream_info.sps and nalu_type == 7 then

_2?3sk/eWMFE#Z0

4Un$]L6r#U0                        stream_info.sps = str_bytes

b/Cd#G dj#G051Testing软件测试网'L-Pu)s s@

                    elseif not stream_info.pps and nalu_type == 8 then51Testing软件测试网^3_Y$nsC,?Zb

51Testing软件测试网w(oHs"g(g P_

                        stream_info.pps = str_bytes

+?} ` n*L4TC;[z0

xu7d#` r#_1\_ i0                    end

?{]g!D4fu)p@5H051Testing软件测试网!ADy(u2H(Hsc$] N

                end

0K~ sN4a0

(E*y!F|i*c0C,i0                

FW-kmu051Testing软件测试网&n!iBN|y.?"K&B

            else -- second time running51Testing软件测试网4S)sW oX H M)d

)J`p`X;B0                if stream_info.counter2 == 0 then51Testing软件测试网|)I N6\d"Tuy

51Testing软件测试网7`L%ST'i \[Gvd

                    -- write SPS and PPS to file header first51Testing软件测试网a1Ub k1i#@%Rbn*H P

51Testing软件测试网 }[r;`r5?(F

                    if stream_info.sps then51Testing软件测试网,FkWa0E6D1i9U:c

p8r }3W Qn a Gs0                        stream_info.file:write("\00\00\00\01")

2i-lLBeaj051Testing软件测试网_Z)?~1nM(S:Oa

                        stream_info.file:write(stream_info.sps)51Testing软件测试网rX l&_C"i y5K/[

;V K@'hNoZ7[|0                    else51Testing软件测试网L%a XB O4GB5S/M}d$Z

51Testing软件测试网B2GvN"g\i5t

                        twappend("Not found SPS for [" .. stream_info.filename .. "], it might not be played!\n")

CL$N-gsv,Y0

Y.L%W(TZ L R1}A#E F0                    end51Testing软件测试网ua[9J?}

I}'f [Y8j0                    if stream_info.pps then

r+M7A2X*TmiY0

D(gg-K&I0                        stream_info.file:write("\00\00\00\01")

)r:i-KZ"V_0

+d|LOME(pRo0                        stream_info.file:write(stream_info.pps)

k0w5Qt4W;S051Testing软件测试网n4Zf/F,l

                    else

;I1Xd0f@%J\7}GD051Testing软件测试网Q!zk5K2z

                        twappend("Not found PPS for [" .. stream_info.filename .. "], it might not be played!\n")

@!mzCy/e!A y051Testing软件测试网6O_c9uu8|

                    end51Testing软件测试网5zk2K%Z({X

51Testing软件测试网rW'uveOy8k

                end51Testing软件测试网Y9[[@1P o`K

g#u0E#Z? N:r0            51Testing软件测试网W*uX&jR:t5f1_\

51Testing软件测试网7u0J1[`)ps

                if begin_with_nalu_hdr then51Testing软件测试网(S QNu3f~u){

"y7qE ^c ?| j4x0                    -- *.264 raw file format seams that every nalu start with 0x00000001

d?fO~5d~D.P/~4c0

5H!s)\6|soJ$C3r e0                    stream_info.file:write("\00\00\00\01")51Testing软件测试网p(rV zO

51Testing软件测试网5e!j"nRuPJ"P

                end

WVo Ph3^"lw051Testing软件测试网2F$_Ki8xb;{M

                stream_info.file:write(str_bytes)51Testing软件测试网B0jr2P,C5j+?4m

2Dvj4b;}q+@0                stream_info.counter2 = stream_info.counter2 + 151Testing软件测试网x*~{b;Cx

2q7Ynr(S:rvi4v0                

3qm$F1F1J7e X/m0

^9|s}$t$OG;yv0                if stream_info.counter2 == stream_info.counter then51Testing软件测试网2N*o4Pa^,z] G D

Rz$E+c.t-a:I"G;Gw0                    stream_info.file:flush()51Testing软件测试网N1RGTA#y.li o

I/|%K H9?6D/[*i0                    twappend("File [" .. stream_info.filename .. "] generated OK!\n")

u9UCXU0

R R#q\:^M(W1W0                end

_"Y:b.^K2Dy!Z051Testing软件测试网X6H[i5y

                -- update progress window's progress bar

7um~8{A2C!dF0

}R!n.XD#F0S/_#t0                if stream_info.counter > 0 then pgtw:update(stream_info.counter2 / stream_info.counter) end51Testing软件测试网n'b~6?!aV#f

51Testing软件测试网`z [tR7o,c

            end51Testing软件测试网c O,VwHYI

51Testing软件测试网[%z:W9SS.~"J

        end51Testing软件测试网"DK k)M0?3\ mJ

6a"dN})G8{$fH0        

1`z6wE(gAS)v0

#D~mEO0        -- read RFC3984 about single nalu/stap-a/fu-a H264 payload format of rtp

e4w3D+n&ws B0

G8ro@8lp0        -- single NALU: one rtp payload contains only NALU

y&U"Rm"O Ge051Testing软件测试网` DzX _!s"}

        function process_single_nalu(stream_info, h264)51Testing软件测试网["~p_u.H

51Testing软件测试网o`&oS0[;b

            write_to_file(stream_info, h264:tvb()():string(), true)51Testing软件测试网G!P sWkeZ

51Testing软件测试网r6_%\/z/cIH} q

        end

3] sB[MM051Testing软件测试网 Qbl}4u-`$t

        51Testing软件测试网4r-KC_.j

:K(ZQ'ITQ9_J+]0        -- STAP-A: one rtp payload contains more than one NALUs

p(l Bj1c~0

3c-{o)WDa'LZ1U)C0        function process_stap_a(stream_info, h264)51Testing软件测试网6EP6|P1XF` w

51Testing软件测试网U3Q2g5qrf wOa1e

            local h264tvb = h264:tvb()

ak3Y,tS0L;e RpAa051Testing软件测试网i Uj$a1_

            local ffset = 1

F6|;a4xrq-o#sk-d0

0uR BC*~.C5kU0            repeat

5@Y D8a*uz#tu051Testing软件测试网^e ZB_6hC

                local size = h264tvb(offset,2):uint()51Testing软件测试网~})P!I~E1R EE'S

|%f!G5o C0                write_to_file(stream_info, h264tvb(offset+2, size):string(), true)51Testing软件测试网G3}i YsV]

51Testing软件测试网Mc/k SU2Y~L

                ffset = offset + 2 + size51Testing软件测试网:[(RTF.gL,f Q

&n@AD%NL0            until offset >= h264tvb:len()51Testing软件测试网:Tl!~4Y;o$i

xi%wq~O!eYM+s0        end

U~$vnlynS0

-G#iy*} pq0        51Testing软件测试网|C2DW"T/i:QU&A&l

51Testing软件测试网B)NY+V_)r

        -- FU-A: one rtp payload contains only one part of a NALU (might be begin, middle and end part of a NALU)51Testing软件测试网/s6t}3H*vr d:u4@

51Testing软件测试网 coB8vHBC

        function process_fu_a(stream_info, h264)

X`W h3Is051Testing软件测试网 ut?1VP%v

            local h264tvb = h264:tvb()

ReMO%YbT-gd051Testing软件测试网*e,|*lE$Sc

            local fu_idr = h264:get_index(0)

aK7v5gQW Yu(q051Testing软件测试网zCa9m$[Ve/]

            local fu_hdr = h264:get_index(1)51Testing软件测试网7Lu5P*H4@1lR

DW,?N9O+e0            if bit.band(fu_hdr, 0x80) ~= 0 then51Testing软件测试网8t |D,X[a

51Testing软件测试网rodg9?y6Dj%v)I

                -- start bit is set then save nalu header and body

F4KA9Kux V!`'I051Testing软件测试网 zA/}jp_,WcZ

                local nalu_hdr = bit.bor(bit.band(fu_idr, 0xE0), bit.band(fu_hdr, 0x1F))51Testing软件测试网a4H&lz)R3iG

H m7~(l)I1dhH Z0                write_to_file(stream_info, string.char(nalu_hdr), true)

O#qO&X/Q6Pm([*q+Z^0

,Bn%qVIUps0            else

nX&KWu&l{ _4D0

:Hx^,Y:~ xG&q0                -- start bit not set, just write part of nalu body

`b nsXx&[6jz0

+PE0F5zw@1m0            end

#|1gaf$BPF|_z0

3W0Bdu4DH0            write_to_file(stream_info, h264tvb(2):string(), false)

8IDR AEY0^5A0

&A*d\}IwI0        end51Testing软件测试网PX3?*p7W5e6k/I

51Testing软件测试网bhUMj!V7p

        

FWWT*y~[eOe051Testing软件测试网%DC dfV+nv

        -- call this function if a packet contains h264 payload

d5D+VU-jp0

.HM?B;}&I0        function my_h264_tap.packet(pinfo,tvb)

R8NnEMz({OD1J.D0

-n*fCa nSP5`0            local h264s = { f_h264() } -- using table because one packet may contains more than one RTP

(U^(A!C B0

V3Yl }+p5\E+fB0            for i,h264_f in ipairs(h264s) do

Q9YHs~3_%Z2Z&p ]051Testing软件测试网"[} N_|

                if h264_f.len < 2 then51Testing软件测试网 L&D+kqwI1`9`

51Testing软件测试网!x:]Z)TOC

                    return51Testing软件测试网V#bI](P

51Testing软件测试网5Y'LT2|;RNj:E

                end51Testing软件测试网P2u.a5S^ od6T}

:Z&W&j.G _9iiD0                local h264 = h264_f.value   -- is ByteArray

)iX{A"h z)N0

F+R$EN%]Uf']/p0                local hdr_type = bit.band(h264:get_index(0), 0x1F)51Testing软件测试网 ?0Z5sn0LuD4Zi

51Testing软件测试网;rLV+R5l#O8m/K

                local stream_info = get_stream_info(pinfo)51Testing软件测试网GW&MUMk"hB

51Testing软件测试网"K]~:rJv

                

.{+een"s,Wv0

4i.W4oI uS0                if hdr_type > 0 and hdr_type < 24 then51Testing软件测试网,_7`8A K9xfwl

!q'c2n+Ue @O5mF4~q0                    -- Single NALU51Testing软件测试网8bu,N/agi

51Testing软件测试网S%W@;R J:O

                    process_single_nalu(stream_info, h264)

K%k&oL2UI S0

.Cwxh(}C2GCG0                elseif hdr_type == 24 then

N a@;`rE6U~$^W&ru0

+u~X$h4U'A}0                    -- STAP-A Single-time aggregation

)U0Sct2pi0

3}ny_]`?,P0_0]0                    process_stap_a(stream_info, h264)51Testing软件测试网6Pq%H:kvZ[ p

k+yYY/OX&i0                elseif hdr_type == 28 then51Testing软件测试网$@8v?4K_?

51Testing软件测试网'vayW%Y_I3\

                    -- FU-A

,b[2R:i ]K0

"[ CT@^C Q0                    process_fu_a(stream_info, h264)

_.F&eN]6y&y0

)aW-G[a0                else

+L3Mh:pt a1Qh051Testing软件测试网z2Y%aV8|:`+m|8Ax

                    twappend("Error: unknown type=" .. hdr_type .. " ; we only know 1-23(Single NALU),24(STAP-A),28(FU-A)!")

;?@Sq,O!Sj051Testing软件测试网 A(V`v?}$E p7i

                end

9\1b Zf"T!lfd0

Di9`G,VK I0            end

a_1s~)k*t(p-QO051Testing软件测试网/Y hL1A]9c A3g)w'f

        end

0dJj%ghI0

&S fq5h#n*Mb$I TPy0        

@_Yjn6Gua051Testing软件测试网(q.r7W J6aJ

        -- close all open files

J9G;p:K a0

(?!J6J(\i(Y*_w0        function close_all_files()51Testing软件测试网v j2rPthr

51Testing软件测试网5t7^M#dLL

            if stream_infos then

P4sU5` {+w051Testing软件测试网$?lyt%f

                for id,stream in pairs(stream_infos) do

[/t Q*} Od0

M ~*nPO J,i0                    if stream and stream.file then

q0L#@I;A1x8I_+T0

S+l U Q(L0~ c%M0                        stream.file:close()

2Z%`n(sHr5J.Cz0

C8\+W;r!w yk~0                        stream.file = nil

0v:UK&H3[D0

q)L;ho#|Dl0                    end51Testing软件测试网u-y G|,x:qUV {

51Testing软件测试网VpU4l8fKC`

                end

O X PQ#W0nt[051Testing软件测试网[d u^*q+_&?i-fO

            end

!f`!EdSV@051Testing软件测试网2I/Z$r$W(kz

        end51Testing软件测试网-RP0OV6w

z ]t@`#C+YV0        51Testing软件测试网o g'qH-@'E

k1P$r?Q-?~%Qj;lW0        function my_h264_tap.reset()51Testing软件测试网6]o&M"H QW E1P#T(rDQ|/X

t@$G EH-s8RMi0            -- do nothing now

u.e)\'`k+C0

Z)Q3yL/p0\%?m0        end

,h#uO7^L/]"\m8W` P!jk0

n\}(p x%\#E M0        51Testing软件测试网tZ QC7nPk"h+i}

51Testing软件测试网0bgQG.G T4Q\W)z&h

        function remove()

pxjO ux&_ t F*R051Testing软件测试网n2fWGS

            close_all_files()

V)K h/ho#c"G051Testing软件测试网W}g I0k A'L

            my_h264_tap:remove()

/J&z^L Xl\051Testing软件测试网~;T,s9`?-_ Z

        end51Testing软件测试网 p7pn]8Kp@Ze R

51Testing软件测试网(UW rcT)P!es

        

+W+aR |.gD0

$e&k1E%A,F@ CB)`P"|\0        tw:set_atclose(remove)

~uuGy"rLI051Testing软件测试网*],_p/Q X I+g

        51Testing软件测试网G)|MF |3n)vI

51Testing软件测试网6E-i"N @,a_p

        -- first time it runs for counting h.264 packets and finding SPS and PPS

@ Z$p5\r3H*RC)V051Testing软件测试网R rG]8T9}brH

        retap_packets()

I eHs)?/V VA f,S d0

!Ld*u_PS0        first_run = false51Testing软件测试网O$j Me)b

'm{h'h c3I.hg0        -- second time it runs for saving h264 data to target file.51Testing软件测试网^YQd P8Cbc

0|*c ?II2Lh0        retap_packets()

w;aQ7yX/B7O0

7W EOp6[Y5qq%d5ct0        -- close progress window

.V_qP*G0

]'C1L(d/J0        pgtw:close()51Testing软件测试网1x)w%n s'NqK`,Fz)YgT7M

51Testing软件测试网jR~3F2D9J bkOL

    end51Testing软件测试网3Ek+Ay$| lo,L

6uC%E1P]Z5B$`0    51Testing软件测试网:y$Xk%lxY|2D

(ts6]\n:_0    -- Find this feature in menu "Tools->"Export H264 to file [HQX's plugins]""51Testing软件测试网J!XE\^Py

51Testing软件测试网6x8HB;Yu J

    register_menu("Export H264 to file [HQX's plugins]", export_h264_to_file, MENU_TOOLS_UNSORTED)

f$o1~7G~lM b#r;H051Testing软件测试网&D4lA0r#o Vb

end

UZ9xjitb6Y0

Wmw'bP,_lI1G9M5u3x051Testing软件测试网1dGi2L7^5WD#L
51Testing软件测试网 O1o Mr1~1x#A5rpQ

2r%~roN U$b3h0把代码保存成h264_export.lua文件,放到wireshark安装目录下,然后修改wireshark安装目录下的init.lua文件:

!o!k(^I%j A0

$`\_[*IlB.R.~[0(1)若有disable_lua = true这样的行,则注释掉;

'Ono+[-X0R0liv$\051Testing软件测试网4l"@o i{Q~(z*F

(2)在文件末加入dofile("h264_export.lua")

9f)A&u)Z#y_f051Testing软件测试网6X"i*T1cd-W

重新打开wirekshark就能使用该功能了。51Testing软件测试网7U(W@ X;L-p|`1QI/s

51Testing软件测试网)M n/zlH-j?

 生成的文件在桌面。

1}@Wb'E X-J j r051Testing软件测试网;@:H+rrU/N"C e

另外,264裸码流文件一般播放器不一定能播放,推荐使用ffmpeg的ffplay播放,或用ffmpeg转成通用文件格式播放。

#gN2v!p,? P,eSMW7h`051Testing软件测试网 p&c m:LH5q0s4{,YK

 我用的是Elecard_StreamEye测试的,生成的包正常播放。

L(B;N RWM?"f0

"onYU"VMw0 很想把工具上传上来,但一直都未成功。51Testing软件测试网WU6U"v z'W?Ca1I6e


dQz2l_ D0

-laJ!q]M051Testing软件测试网m5h,S3l*W^ m!TY
好了,下面是广告时间:51Testing软件测试网j F3f ZeI}6Z1Jr

*Ki9S5XN0
测试SIP协议的同志们可以加入群: 323827101,共同探讨哦!
群共享里可能会有你需要的资料!

TAG: H264 h264祼码流播放

 

评分:0

我来说两句

luoriver

luoriver

北漂一族,80后,计算机专业,从事SIP相关软件测试3年,热爱生活,崇尚运动。 爱看WWE、公开课。爱钻“牛角尖”,这就是我:luorivr!!!!!

日历

« 2024-05-02  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 345966
  • 日志数: 96
  • 图片数: 1
  • 建立时间: 2012-12-27
  • 更新时间: 2014-05-03

RSS订阅

Open Toolbar