Well, that's a cool suggestion. Will have to wait till tomorrow to try
it out, though.
My prediction is that it will just move the glitch from the end of my
part to the beginning, but I'll find out.
Thanks,
--George
On 1/25/20 1:53 PM, Yellow Penguin wrote:
You are correct about that.
What happens is that the timestamp is not zero when you cut at a
non-keyframe when using stream copy, because the keyframe is at time 0.
With B-frames this can lead to negative timestamps, because the keyframe
can come after that. This should not be a problem when you only cut at
I-frames, but in h264 B-frames can reference arbitrary frames that are
outside the region you cut. If this is the case, concatenating after
cutting doesn't seem possible without transcoding to me. One thing you
could try, but this is really a wild hunch, is to alter the timestamps in
the part that you create so they match the offset in the part you cut from
the original.
On Sat, Jan 25, 2020 at 8:23 PM George R. Welch <geo...@grwelch.com> wrote:
Thank you for the suggestion.
As I understand it, filtering and stream copy cannot be used together.
Am I wrong? As I said, I must not transcode the pieces of the original
video file I am using.
If I could transcode the original, this process would be easy.
--George
On 1/25/20 1:10 PM, Yellow Penguin wrote:
Try set-pts=0 as a filter
On Fri, Jan 24, 2020 at 5:24 PM George R. Welch <geo...@grwelch.com>
wrote:
Greetings,
I get video files from another division. It is my task to cut out a
part of the video, and replace it with a part I create. The videos I
receive are h264 with aac audio. It is very strongly hoped that this
can be done without re-encoding the parts of the original which we keep.
I have been using ffmpeg for cutting up the file I receive, and I've
been using the concat demuxer to concatenate the pieces of the original
with the part I make. This has worked well (over a dozen times) until
recently.
In order for concat to work correctly, I take care to make sure the
video I make fits the one I am inserting it into (same frame rate, refs,
etc). I also take care to only cut the original movie at I frames.
I have run into trouble with the most recent job. When I concatenate
the parts, there is a slight glitch when it transitions from the part I
made to the other.
As far as I can tell, the only thing that is different from the previous
runs is that the file I am given is encoded with B frames, whereas that
had never happened before.
An oddity is that when I cut the original video, the timestamp does not
begin at zero:
$ ffmpeg -i input.mkv -ss [start-time] -t [duration] -c copy part1.mkv
[seems to work]
Now look at the result:
$ ffprobe -hide_banner -show_frames -select_streams v part1.mkv
Here is the first frame:
[FRAME]
media_type=video
stream_index=0
key_frame=1
pkt_pts=1968
pkt_pts_time=1.968000
pkt_dts=1968
pkt_dts_time=1.968000
best_effort_timestamp=1968
best_effort_timestamp_time=1.968000
...
I don't understand why the first frame does not start at zero. I have
tried adding "-seek_timestamp 1" but it has no effect.
When I use concat to place this part after my video, then there is a
glitch at the transition.
However, if I change the flag to the input:
$ ffmpeg -ss [start-time] -i input.mkv -t [duration] -c copy part1.mkv
then ffmpeg generates some errors:
[matroska @ 0x7ffadb028600] failed to avoid negative pts -58 in stream
1.
Try -avoid_negative_ts 1 as a possible workaround.
Repeating the command with -avoid -avoid_negative_ts 1 still generates
the same message, and the output is the same.
Now when I look at the first frame it does start at zero, but there is
still a glitch at the transition after concatenating.
Does anyone have any suggestions? Is it impossible to concat segments
with B frames?
Thank you in advance,
--George
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".