2015-09-27 36 views
2

我使用以下ffmpeg命令創建從H.264編碼的文件的傳輸流:ffprobe不顯示MPEG傳輸流的數據包大小爲188個字節

ffmpeg -i encoded.mp4 -c copy -map 0 -vbsf h264_mp4toannexb mpegts sample.ts

現在我想要查詢的幀和傳輸流內的數據包。我用

ffprobe -show_frames

其示出了用於音頻和視頻幀的幀的信息。但我對pkt_size字段感到困惑。是音頻和視頻(I/B/P幀)每個基本流的實際幀大小?

而且,當我運行

ffprobe -show_packets

是它該做的傳輸流中的每個數據包的詳細信息?因爲每個數據包的size字段不是188字節,而是與-show_frames得到的pkt_size相同。

請問有人可以解釋爲什麼傳輸流的-show_packets的大小不是188字節?在複用mp4TS時我做錯了什麼?

+0

看來ffprobe只給出了有關PES包,而不是即使輸入文件的傳輸流文件(TS容器)的TS包的信息。這是對的嗎? – CompNet

+0

我還沒有使用ffprobe,但很可能它會顯示解複用數據包的大小,即來自基本(h264)流。您可以嘗試使用mpeg-ts分析器軟件,網上幾乎免費。 –

+0

嗨安東,謝謝。是的,我使用了ts分析器,現在它正確顯示了每個TS數據包的詳細信息,並且TS數據包的總數與(.ts文件/ 188的大小)完全一致。只有我無法確認的是每個TS數據包在.ts文件中複用的時間戳。包含PES報頭的TS數據包爲每個TS數據包提供PTS,DTS但不提供時間戳。有什麼方法可以知道每個TS數據包在TS中被多路複用的時間戳嗎? – CompNet

回答

2

兩者pkt_size必須等於。看到這個ffprobe test from src code from gitHub

[packets_and_frames.packet.0] 
codec_type=audio 
stream_index=0 
pts=0 
pts_time=0.000000 
dts=0 
dts_time=0.000000 
duration=1024 
duration_time=0.023220 
convergence_duration=N/A 
convergence_duration_time=N/A 
size=2048 
pos=642 
flags=K 

[packets_and_frames.frame.0] 
media_type=audio 
stream_index=0 
key_frame=1 
pkt_pts=0 
pkt_pts_time=0.000000 
pkt_dts=0 
pkt_dts_time=0.000000 
best_effort_timestamp=0 
best_effort_timestamp_time=0.000000 
pkt_duration=1024 
pkt_duration_time=0.023220 
pkt_pos=642 
pkt_size=2048 
sample_fmt=s16 
nb_samples=1024 
channels=1 
channel_layout=unknown 

[packets_and_frames.packet.1] 
codec_type=video 
stream_index=1 
pts=0 
pts_time=0.000000 
dts=0 
dts_time=0.000000 
duration=2048 
duration_time=0.040000 
convergence_duration=N/A 
convergence_duration_time=N/A 
size=230400 
pos=2717 
flags=K 

[packets_and_frames.frame.1] 
media_type=video 
stream_index=1 
key_frame=1 
pkt_pts=0 
pkt_pts_time=0.000000 
pkt_dts=0 
pkt_dts_time=0.000000 
best_effort_timestamp=0 
best_effort_timestamp_time=0.000000 
pkt_duration=2048 
pkt_duration_time=0.040000 
pkt_pos=2717 
pkt_size=230400 
width=320 
height=240 
pix_fmt=rgb24 
sample_aspect_ratio=1\:1 
pict_type=I 
coded_picture_number=0 
display_picture_number=0 
interlaced_frame=0 
top_field_first=0 
repeat_pict=0 

[packets_and_frames.packet.2] 
codec_type=video 
stream_index=2 
pts=0 
pts_time=0.000000 
dts=0 
dts_time=0.000000 
duration=2048 
duration_time=0.040000 
convergence_duration=N/A 
convergence_duration_time=N/A 
size=30000 
pos=233138 
flags=K 

[packets_and_frames.frame.2] 
media_type=video 
stream_index=2 
key_frame=1 
pkt_pts=0 
pkt_pts_time=0.000000 
pkt_dts=0 
pkt_dts_time=0.000000 
best_effort_timestamp=0 
best_effort_timestamp_time=0.000000 
pkt_duration=2048 
pkt_duration_time=0.040000 
pkt_pos=233138 
pkt_size=30000 
width=100 
height=100 
pix_fmt=rgb24 
sample_aspect_ratio=1\:1 
pict_type=I 
coded_picture_number=0 
display_picture_number=0 
interlaced_frame=0 
top_field_first=0 
repeat_pict=0 

是一樣的。 pkt_sizebytes中壓縮幀的大小。

this issue ticket too

相關問題