-
Notifications
You must be signed in to change notification settings - Fork 479
Video passthrough #1390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Video passthrough #1390
Conversation
|
||
# rtsp | ||
#rtsp_transport udp | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please add the modules name as a prefix to the config item ?
include/baresip.h
Outdated
struct vidpacket { | ||
uint8_t *buf; /**< Buffer memory */ | ||
size_t size; /**< Size of buffer */ | ||
size_t pts; /**< Position in buffer */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should timestamp also be included here ?
typedef int (videnc_copy_h)(struct videnc_state *ves, bool update, | ||
const struct vidpacket *packet, | ||
uint64_t timestamp); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps packetize is a better name ?
@@ -89,6 +89,7 @@ static struct vidcodec h264 = { | |||
.dech = avcodec_decode_h264, | |||
.fmtp_ench = avcodec_h264_fmtp_enc, | |||
.fmtp_cmph = avcodec_h264_fmtp_cmp, | |||
.copyh = avcodec_copy, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider this packetizeh
and avcodec_packetize
...
st->pkth, st->arg); | ||
break; | ||
|
||
case AV_CODEC_ID_MPEG4: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MPEG4 is no longer supported
@@ -245,6 +254,13 @@ int avformat_shared_alloc(struct shared **shp, const char *dev, | |||
st->au.idx = -1; | |||
st->vid.idx = -1; | |||
|
|||
conf_get_str(conf_cur(), "pass_through", | |||
pass_through, sizeof(pass_through)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps conf_get_bool
is better ?
|
||
vp.buf = pkt->data; | ||
vp.size = pkt->size; | ||
timestamp = pkt->pts; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does timestamp and pts have the same timebase ?
this is a very nice patch, many thanks! some comments:
|
I added the vidsrc packet handler in commit 646ffdf could you please rebase your patch on top of master ? |
I have also updated the v4l2_codec module to use the packet handler. there are a couple of things we have to figure out.
consider this usecase. Two endpoints A and B both supports H.263 and H.264
|
f8d045c
to
323249d
Compare
Hi @alfredh , I've just rebased this branch on master. Please be aware that I've just checked that it compiles, nothing more. For your other comments on the code: I'm fine with all of them; feel free to introduce these changes yourself (or we can do it, but it may take some days, in that case just let us know how you prefer to proceed). Regarding your questions in #1390 (comment) and #1390 (comment) , not being the original author of this feature I'd ask @mediamagic-dev if they could kindly reply with their ideas. Thanks! |
could you also please have a look at the formatting:
|
3264655
to
69272f1
Compare
Done (make ccheck shows no errors or warnings, now) |
thanks! there is also a compiler error:
the vidpacket now looks like this: struct vidpacket {
uint8_t *buf; /**< Buffer memory */
size_t size; /**< Size of buffer */
uint64_t timestamp; /**< Timestamp in VIDEO_TIMEBASE units */
}; |
Seen it, and I've added a TODO comment in the function body since I'm not sure how to handle it not being too familiar with the code. |
regarding selecting which codec to use; I have a proposal for that ...
the content of fourcc/codecid is for example:
|
the patch was written by: Media Magic Technologies <developer@mediamagictechnologies.com> and Divus GmbH <developer@divus.eu> ref: #1390
hi, I merged the rtsp_transport part into master. could you please rebase again ? if you want I can try to add the packetizer interface to avcodec. |
…video In this PR, we introduce the possibility to passthrough the video received by the avformat module without the need to decode and re-encode it. To achieve this goal, three new settings were introduced: * **pass_through**: when set to **yes**, video passthrough is enabled * **rtsp_transport**: it can be set to **tcp**, **udp**, **udp_multicast**, **http** or **https** to force the kind of transport used to communicate with the camera (when RTSP is used) * **profile_level_id**: to set the profile level of the output stream, for example **42002a** to set profile_idc to 42, profile_iop to 00 and h264_level_idc to 2a The copyright of this work is shared by Media Magic Technologies <developer@mediamagictechnologies.com> and Divus GmbH <developer@divus.eu> and it's released under the same licence used by Baresip.
69272f1
to
365fcdf
Compare
That's great, thanks!!
Rebase done. I've also renamed the option to "avformat_pass_through".
That would be cool; we'd like to address the other open issues as soon as possible, but it's a complicated time, so as always any help is welcome. Thanks! |
original patch by: * Media Magic Technologies <developer@mediamagictechnologies.com> * and Divus GmbH <developer@divus.eu> #1390 the patch was trimmed and improved by me.
original patch by: * Media Magic Technologies <developer@mediamagictechnologies.com> * and Divus GmbH <developer@divus.eu> #1390 the patch was trimmed and improved by me.
hi, I modified your patch and merge it to master. it was tested with avformat and a h264 camera:
many thanks for your contributions :) could you please retest with master HEAD and check that everything is working any small issue please report as Issues or with a PR. closing this. |
That's great! The code looks good; we will test master in our environment and if we'll find any problems we will open a PR or issue. Many thanks! |
Basically it's a back-port of baresip/baresip#1390 with a tiny fix in baresip/baresip#1692. Signed-off-by: Alexey Brodkin <alexey.brodkin@gmail.com>
In this PR we introduce the possibility to passthrough the video received by the avformat module without the need to decode and re-encode it. The feature was discussed in #296
To achieve this goal, three new settings were introduced:
The copyright of this work is shared by Media Magic Technologies developer@mediamagictechnologies.com ( @mediamagic-dev ) and Divus GmbH developer@divus.eu ( @divusgmbh ) and it's released under the same licence used by Baresip.
The development was done on tag v1.0.0 and then rebased on master; we tested it on a very low-power system, and can confirm a huge benefit in terms of CPU usage.