Answer the question
In order to leave comments, you need to log in
How to multiplex h264 video to mpeg-ts without knowing anything about video parameters?
Good day!
I want to write my h264 muxer to mpeg-ts without any external libraries
(only video (h264->mpeg-ts), - no audio).
What is mpeg-ts - I'm slowly understanding (but it's very difficult), some things are incomprehensible:
Is it possible to pack a video into an mpeg-ts container without knowing anything about it?
Well, I want to do this:
the first header comes with PAT, then PMT, then the header with pure h264 payload .. After 40 packets again PAT / PMT, etc.?
But then I ran into an Adaptation Field in which you need to write pts and dts. Where to take them from? Are they heavily dependent on the original video that is currently being packed into this container?
Or is it a purely transport thing that does not depend on the codec and can be generated on the fly, for example, on a streaming server?
Answer the question
In order to leave comments, you need to log in
So, I read here that DTS is only needed if there are B-frames in the video. In this case, I have a video without B-frames, so the issue with DTS has been resolved for now. It remains to put down the TCP.
I played around with ffprobe + ffmpeg, and so:
I encode the file into pure h264 without audio and B-frames:
Now I look at the resulting file through ffprobe:
[FRAME]
media_type=video
key_frame=0
pkt_pts=N/A
pkt_pts_time=N/A
pkt_dts=N/A
pkt_dts_time=N/A
best_effort_timestamp=N/A
best_effort_timestamp_time=N/A
pkt_duration=48000
pkt_duration_time=0.040000
pkt_pos=929
pkt_size=29
width=640
height=360
pix_fmt=yuv420p
sample_aspect_ratio=1:1
pict_type=P
coded_picture_number=2
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
[/FRAME]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question