Re: re-encoding and transcode (codec copy) on same file.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: re-encoding and transcode (codec copy) on same file.

Andy Shaules

sorry if this client top posts, but to answer, you can do 1 of 2 things. assume it is different and insert it before returning to the unprocessed clip. or you can check if they are different by doing a comparison.


Sent from my T-Mobile 4G LTE Device

-------- Original message --------
From: YIRAN LI <[hidden email]>
Date: 4/7/17 3:15 PM (GMT-08:00)
To: "This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter." <[hidden email]>, FFmpeg user questions <[hidden email]>
Subject: [Libav-user] re-encoding and transcode (codec copy) on same file.

Hi guys,

I'm investigating if it's possible to do editing and transcode on same file.

I mean use -vcodec copy, we can readout packets and write them directly into output file without re-encoding. But if it's possible, for example if I have a 2 mins video, re-encode 1st min because there're some effects applied to that region but copy 2nd part?

My concern is, for example we know H.264 has extradata, if I re-encode first part but keep 2nd part, how if new extradata is different from old extradta?

Anyone have suggestion on this? and any other possible problems doing this?

Thanks

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: re-encoding and transcode (codec copy) on same file.

YIRAN LI


2017-04-10 7:16 GMT+10:00 bowljoman <[hidden email]>:

sorry if this client top posts, but to answer, you can do 1 of 2 things. assume it is different and insert it before returning to the unprocessed clip. or you can check if they are different by doing a comparison.


​Thanks for your suggestion. Let's say if original H.264 video stream has AVCC bitstream, no matter you encode 1st part with Annex-b or AVCC, as long as it's different from orginal format, I won't be able to do codec copy using readpacket/writepacket, right?

Thanks
Sent from my T-Mobile 4G LTE Device

-------- Original message --------
From: YIRAN LI <[hidden email]>
Date: 4/7/17 3:15 PM (GMT-08:00)
To: "This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter." <[hidden email]>, FFmpeg user questions <[hidden email]>
Subject: [Libav-user] re-encoding and transcode (codec copy) on same file.

Hi guys,

I'm investigating if it's possible to do editing and transcode on same file.

I mean use -vcodec copy, we can readout packets and write them directly into output file without re-encoding. But if it's possible, for example if I have a 2 mins video, re-encode 1st min because there're some effects applied to that region but copy 2nd part?

My concern is, for example we know H.264 has extradata, if I re-encode first part but keep 2nd part, how if new extradata is different from old extradta?

Anyone have suggestion on this? and any other possible problems doing this?

Thanks

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user



_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: re-encoding and transcode (codec copy) on same file.

Andy Shaules
On 4/10/2017 4:37 PM, YIRAN LI wrote:


2017-04-10 7:16 GMT+10:00 bowljoman <[hidden email]>:

sorry if this client top posts, but to answer, you can do 1 of 2 things. assume it is different and insert it before returning to the unprocessed clip. or you can check if they are different by doing a comparison.


​Thanks for your suggestion. Let's say if original H.264 video stream has AVCC bitstream, no matter you encode 1st part with Annex-b or AVCC, as long as it's different from orginal format, I won't be able to do codec copy using readpacket/writepacket, right?

Thanks
Sent from my T-Mobile 4G LTE Device

-------- Original message --------
From: YIRAN LI <[hidden email]>
Date: 4/7/17 3:15 PM (GMT-08:00)
To: "This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter." <[hidden email]>, FFmpeg user questions <[hidden email]>
Subject: [Libav-user] re-encoding and transcode (codec copy) on same file.

Hi guys,

I'm investigating if it's possible to do editing and transcode on same file.

I mean use -vcodec copy, we can readout packets and write them directly into output file without re-encoding. But if it's possible, for example if I have a 2 mins video, re-encode 1st min because there're some effects applied to that region but copy 2nd part?

My concern is, for example we know H.264 has extradata, if I re-encode first part but keep 2nd part, how if new extradata is different from old extradta?

Anyone have suggestion on this? and any other possible problems doing this?

Thanks

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user




_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user

It doesnt matter what the inputs are. just convert them to one or the other type. the final stream can be assembled with all avc or avcc packets. choose one or the other.


_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: re-encoding and transcode (codec copy) on same file.

YIRAN LI


2017-04-12 0:55 GMT+10:00 Andy Shaules <[hidden email]>:
On 4/10/2017 4:37 PM, YIRAN LI wrote:


2017-04-10 7:16 GMT+10:00 bowljoman <[hidden email]>:

sorry if this client top posts, but to answer, you can do 1 of 2 things. assume it is different and insert it before returning to the unprocessed clip. or you can check if they are different by doing a comparison.


​Thanks for your suggestion. Let's say if original H.264 video stream has AVCC bitstream, no matter you encode 1st part with Annex-b or AVCC, as long as it's different from orginal format, I won't be able to do codec copy using readpacket/writepacket, right?

Thanks
Sent from my T-Mobile 4G LTE Device

-------- Original message --------
From: YIRAN LI <[hidden email]>
Date: 4/7/17 3:15 PM (GMT-08:00)
To: "This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter." <[hidden email]>, FFmpeg user questions <[hidden email]>
Subject: [Libav-user] re-encoding and transcode (codec copy) on same file.

Hi guys,

I'm investigating if it's possible to do editing and transcode on same file.

I mean use -vcodec copy, we can readout packets and write them directly into output file without re-encoding. But if it's possible, for example if I have a 2 mins video, re-encode 1st min because there're some effects applied to that region but copy 2nd part?

My concern is, for example we know H.264 has extradata, if I re-encode first part but keep 2nd part, how if new extradata is different from old extradta?

Anyone have suggestion on this? and any other possible problems doing this?

Thanks

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user




_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user

It doesnt matter what the inputs are. just convert them to one or the other type. the final stream can be assembled with all avc or avcc packets. choose one or the other.


​Thanks for reply.

I did some research yesterday and I think no matter packets in the file is in starting code (annex-b) or size​ (avcc) mode, I can always detect and convert it to another mode.

The problem is, if I re-encode a part and keep another part, how can I guarantee the SPS/PPS values for 2 parts are same? If they are different, even if they are in packets (in-band) instead of in global header, is such a file standard compliant ?

Thanks


_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user



_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Loading...