almost there I think (hope)

This commit is contained in:
Unknown 2018-02-15 18:43:45 +10:30
parent 1407ebe39b
commit a38b86236c
10 changed files with 12 additions and 10 deletions

View File

@ -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),
}...)

View File

@ -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,

BIN
revid/ffmpegOutput.flv Normal file

Binary file not shown.

BIN
revid/pls.flv Normal file

Binary file not shown.

View File

@ -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()
}
*/

BIN
rtmp/ffmpegOutput.flv Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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))
}
*/

Binary file not shown.