mirror of https://bitbucket.org/ausocean/av.git
almost there I think (hope)
This commit is contained in:
parent
1407ebe39b
commit
a38b86236c
|
@ -16,6 +16,7 @@ const (
|
|||
VideoTagType = 9
|
||||
AudioTagType = 8
|
||||
KeyFrameType = 1
|
||||
InterFrameType = 2
|
||||
H264 = 7
|
||||
AVCNALU = 1
|
||||
DataHeaderLength = 5
|
||||
|
@ -69,7 +70,7 @@ func (t *VideoTag) ToByteSlice() (output []byte) {
|
|||
byte(t.Timestamp),
|
||||
byte(t.TimestampExtended),
|
||||
0x00, 0x00, 0x00,
|
||||
byte(t.FrameType << 4) | byte(t.Codec),
|
||||
0x00 | byte(t.FrameType << 4) | byte(t.Codec),
|
||||
t.PacketType,
|
||||
byte(t.CompositionTime >> 16),byte(t.CompositionTime >> 8),byte(t.CompositionTime),
|
||||
}...)
|
||||
|
|
|
@ -96,6 +96,7 @@ func (g *flvGenerator) generate() {
|
|||
for {
|
||||
select {
|
||||
case videoFrame := <-g.inputChan:
|
||||
nalType :=
|
||||
timeStamp := g.getNextTimestamp()
|
||||
videoTag := flv.VideoTag{
|
||||
PrevTagSize: uint32(g.lastTagSize),
|
||||
|
@ -103,7 +104,7 @@ func (g *flvGenerator) generate() {
|
|||
DataSize: uint32(len(videoFrame)) + flv.DataHeaderLength,
|
||||
Timestamp: timeStamp,
|
||||
TimestampExtended: flv.NoTimestampExtension,
|
||||
FrameType: flv.KeyFrameType,
|
||||
FrameType: flv.InterFrameType,
|
||||
Codec: flv.H264,
|
||||
PacketType: flv.AVCNALU,
|
||||
CompositionTime: 0,
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -122,7 +122,7 @@ func TestRtmpOutput(t *testing.T){
|
|||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
// Test h264 inputfile to flv output files
|
||||
func TestFlvOutputFile(t *testing.T) {
|
||||
config := Config{
|
||||
|
@ -143,10 +143,10 @@ func TestFlvOutputFile(t *testing.T) {
|
|||
time.Sleep(30 * time.Second)
|
||||
revidInst.Stop()
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
// Test h264 inputfile to flv format into rtmp using librtmp c wrapper
|
||||
func TestRtmpOutputUsingLibRtmp(t *testing.T){
|
||||
config := Config{
|
||||
|
@ -156,9 +156,9 @@ func TestRtmpOutputUsingLibRtmp(t *testing.T){
|
|||
Output: Rtmp,
|
||||
RtmpMethod: LibRtmp,
|
||||
RtmpUrl: "rtmp://a.rtmp.youtube.com/live2/w44c-mkuu-aezg-ceb1",
|
||||
FramesPerClip: 2,
|
||||
FramesPerClip: 1,
|
||||
Packetization: Flv,
|
||||
FrameRate: "30",
|
||||
FrameRate: "25",
|
||||
}
|
||||
revidInst, err := NewRevidInstance(config)
|
||||
if err != nil {
|
||||
|
@ -169,4 +169,3 @@ func TestRtmpOutputUsingLibRtmp(t *testing.T){
|
|||
time.Sleep(30*time.Second)
|
||||
revidInst.Stop()
|
||||
}
|
||||
*/
|
||||
|
|
Binary file not shown.
BIN
rtmp/pls.flv
BIN
rtmp/pls.flv
Binary file not shown.
BIN
rtmp/rtmpTesting
BIN
rtmp/rtmpTesting
Binary file not shown.
|
@ -1,7 +1,7 @@
|
|||
|
||||
package main
|
||||
|
||||
package rtmp
|
||||
|
||||
/*
|
||||
// #cgo CFLAGS: -I/home/saxon/Desktop/AusOcean/av/rtmp/
|
||||
// #cgo CFLAGS: -I/home/saxon/Desktop/AusOcean/av/rtmp/rtmp_c/librtmp
|
||||
// #cgo LDFLAGS: /home/saxon/Desktop/AusOcean/av/rtmp/rtmp_c/librtmp/librtmp.a
|
||||
|
@ -10,10 +10,11 @@ package main
|
|||
import "C"
|
||||
|
||||
const (
|
||||
inputFile = "sample.flv"
|
||||
inputFile = "pls.flv"
|
||||
outputUrl = "rtmp://a.rtmp.youtube.com/live2/w44c-mkuu-aezg-ceb1"
|
||||
)
|
||||
|
||||
func main(){
|
||||
C.publish_using_write(C.CString(inputFile), C.CString(outputUrl))
|
||||
}
|
||||
*/
|
||||
|
|
BIN
rtmp/sample.flv
BIN
rtmp/sample.flv
Binary file not shown.
Loading…
Reference in New Issue