don't write non-frames

This commit is contained in:
Isaac Connor 2017-11-30 15:01:48 -05:00
parent f2efc80f22
commit 84c901a01b
2 changed files with 3 additions and 2 deletions

View File

@ -429,8 +429,8 @@ void Event::AddFramesInternal( int n_frames, int start_frame, Image **images, st
void Event::AddPacket( ZMPacket *packet, int score, Image *alarm_image ) {
if ( videoStore ) {
have_video_keyframe = have_video_keyframe || ( packet->codec_type == AVMEDIA_TYPE_VIDEO && ( packet->packet.flags & AV_PKT_FLAG_KEY ) );
if ( videoStore ) {
if ( have_video_keyframe ) {
videoStore->writePacket( packet );
} else {
@ -438,7 +438,7 @@ void Event::AddPacket( ZMPacket *packet, int score, Image *alarm_image ) {
}
//FIXME if it fails, we should write a jpeg
}
if ( packet->codec_type == AVMEDIA_TYPE_VIDEO ) {
if ( have_video_keyframe && ( packet->codec_type == AVMEDIA_TYPE_VIDEO ) ) {
AddFrame( packet->image, *packet->timestamp, score, alarm_image );
} // end if is video
return;

View File

@ -786,6 +786,7 @@ bool VideoStore::setup_resampler() {
return false;
}
#endif
audio_out_stream->time_base = (AVRational){1, audio_out_ctx->sample_rate};
AVDictionary *opts = NULL;
av_dict_set(&opts, "strict", "experimental", 0); // Needed to allow AAC