Re: [FFmpeg-devel] [PATCH 1/2] ffmpeg.c can not process invalid PTS

2015-10-30 Thread
diff --git a/ffmpeg.c b/ffmpeg.c
index f91fb7b..844a03c 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3864,6 +3864,11 @@ static int process_input(int file_index)
 if (pkt.dts != AV_NOPTS_VALUE)
 pkt.dts *= ist->ts_scale;
 
+if (pkt.pts == AV_NOPTS_VALUE)
+pkt.pts = av_rescale_q(ist->next_pts, AV_TIME_BASE_Q, 
ist->st->time_base);
+if (pkt.dts == AV_NOPTS_VALUE)
+pkt.dts = av_rescale_q(ist->next_dts, AV_TIME_BASE_Q, 
ist->st->time_base);
+
 if ((ist->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO ||
  ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) &&
 pkt.dts != AV_NOPTS_VALUE && ist->next_dts == AV_NOPTS_VALUE && 
!copy_ts


==
New patch

At 2015-10-30 10:08:43, "hiccupzhu"  wrote:
>diff --git a/ffmpeg.c b/ffmpeg.c
>index f91fb7b..22766b3 100644
>--- a/ffmpeg.c
>+++ b/ffmpeg.c
>@@ -3864,6 +3864,9 @@ static int process_input(int file_index)
> if (pkt.dts != AV_NOPTS_VALUE)
> pkt.dts *= ist->ts_scale;
> 
>+if(pkt.pts == AV_NOPTS_VALUE)
>+pkt.pts = ist->next_pts;
>+
> if ((ist->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO ||
>  ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) &&
> pkt.dts != AV_NOPTS_VALUE && ist->next_dts == AV_NOPTS_VALUE && 
> !copy_ts
>
>
>Explanation:
>In function "process_input" ffmpeg just handle "pts != AV_NOPTS_VALUE", but 
>not handle "pts == AV_NOPTS_VALUE".Now I fixed it. 
>if ( current_pts == AV_NOPTS_VALUE) {
>current_pts  = predicted_pts;
>}
>
>
>Reproduce:
>1. Download test file http://pan.baidu.com/s/1eQsb9hK;
>2. Run command below:
>ffmpeg -i ./manga.01.ts -vcodec copy -bsf:v h264_mp4toannexb -hls_list_size 0 
>-hls_segment_filename "test_%04d.ts" playlist.m3u8
>3. If the bug not fixed, the HLS slice just one; Then fix the bug, HLS' slice 
>is normally.
>
>
>
>
>
>
> 
>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] ffmpeg.c can not process invalid PTS

2015-10-29 Thread
diff --git a/ffmpeg.c b/ffmpeg.c
index f91fb7b..22766b3 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3864,6 +3864,9 @@ static int process_input(int file_index)
 if (pkt.dts != AV_NOPTS_VALUE)
 pkt.dts *= ist->ts_scale;
 
+if(pkt.pts == AV_NOPTS_VALUE)
+pkt.pts = ist->next_pts;
+
 if ((ist->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO ||
  ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) &&
 pkt.dts != AV_NOPTS_VALUE && ist->next_dts == AV_NOPTS_VALUE && 
!copy_ts


Explanation:
In function "process_input" ffmpeg just handle "pts != AV_NOPTS_VALUE", but not 
handle "pts == AV_NOPTS_VALUE".Now I fixed it. 
if ( current_pts == AV_NOPTS_VALUE) {
current_pts  = predicted_pts;
}


Reproduce:
1. Download test file http://pan.baidu.com/s/1eQsb9hK;
2. Run command below:
ffmpeg -i ./manga.01.ts -vcodec copy -bsf:v h264_mp4toannexb -hls_list_size 0 
-hls_segment_filename "test_%04d.ts" playlist.m3u8
3. If the bug not fixed, the HLS slice just one; Then fix the bug, HLS' slice 
is normally.






 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel