Closed TracelessLe closed 4 years ago
Hi @TracelessLe
VPF generates Annex.B elementary bitstream video which isn't put into any container. So by giving output file *.mp4 extension, it won't change the output file structure. This is done intentionally and users have to mux video output themselves.
P. S. VLC can play Annex.B videos without issues.
Hi @TracelessLe
VPF generates Annex.B elementary bitstream video which isn't put into any container. So by giving output file *.mp4 extension, it won't change the output file structure. This is done intentionally and users have to mux video output themselves.
P. S. VLC can play Annex.B videos without issues.
Thank you for your great help and support! I solve the problem. VPF is an excellent framework! Thans for your efforts!
Hi @TracelessLe VPF generates Annex.B elementary bitstream video which isn't put into any container. So by giving output file *.mp4 extension, it won't change the output file structure. This is done intentionally and users have to mux video output themselves. P. S. VLC can play Annex.B videos without issues.
Thank you for your great help and support! I solve the problem. VPF is an excellent framework! Thans for your efforts!
Hi, @TracelessLe , I encountered the same problem. Could you pls share the way to mux the output video? As far as I know, ffmpeg command can do this( ffmpeg -i output.h264 -c copy output.mp4). But this will cost time to read the bytes(output.h264) from disk and additional time to launch the ffmpeg process. My use of the VPF is to save time encoding the video, so is there any 3-party interface of doing video-mux efficiently? cc @rarzumanyan Thanks!
Hi @wykvictor
PyAV can be used for that, take a look here.
Hi @wykvictor
PyAV can be used for that, take a look here.
Thanks! I tried PyAV and it worded fine. Here is the code snippet, so everyone else could refer to it.
# 1. init
dstFile = av.open(dstFilePath, 'w')
out_stream = dstFile.add_stream('h264', rate = 25)
out_stream.width = w
out_stream.height = h
# 2. mux
encByteArray = bytearray(encFrame) # encFrame from EncodeSingleSurface
pkt = av.packet.Packet(encByteArray)
pkt.pts = pts_time
pkt.dts = pts_time
pkt.stream = out_stream # attach pkt to the stream
dstFile.mux(pkt)
Thank for the code snippet, @wykvictor that's super useful. I'll add this to wiki if you don't mind.
Thank for the code snippet, @wykvictor that's super useful. I'll add this to wiki if you don't mind.
It's fine, very happy if this can help others
Describe the bug I run the SampleDecode.py and SampleEncode.py, but the output video by the encode process is weird. The video generated by VPF encoder has no bitrate and duration information, it can't be played by video player or chrome browser. I input it to ffmpeg and it shows the video information:
To Reproduce Steps to reproduce the behavior:
Expected behavior To generate a normal h264 video that QuickTimePlayer or Chrome browser can play.
Screenshots
Desktop:
Additional context By the way , I find a player name sPlayer on mac can play the generated video, it shows that the video palyed vert fast and no time control bar.
The output video is attached (be zipped) as below: output.mp4.zip
I integrate the SampleDecode.py and SampleEncode.py and finally code I used is attached as below:
SampleDecodeEncode.py.zip