On 7/28/2014 12:08 PM, Nicolas George wrote:
Le decadi 10 thermidor, an CCXXII, Claudiu Rad a écrit :
1. how can i enforce keyframe alignment between output transcoded
(reencoded) streams in ffmpeg? i don't need P/B or other frame types
to be aligned, but I-frames should be exactly on the same frame
numbers on all streams
You could try using the -force_key_frames options, but it is designed for a
few keyframes, not all the keyframes of a stream. For a long video, you
could hit the kernel command line limit or other issues, and for a
continuous stream there is no time limit. Still, have a look.
Or you could force using a constant interval between keyframes, but that
degrades the quality.
Forcing a keyframe on the encoder for the stream #2 based on the decision
made by the encoder for the stream #1 should be rather easy to implement. I
suggest you open a trac ticket tagged as wish/enhancement. Or maybe you can
try your hand implementing it.
thanks. my fear is that trac tickets tagged as wish may take a long time
to be solved even if it would be a trivial task for someone who knows
what to do. and this is understandable by looking at the current list of
trac items. it would seem that i have to get my hands on the code and
try to patch it to support what i need. for this i need help regarding
two matters:
- are the compilation guides at
https://trac.ffmpeg.org/wiki/CompilationGuide up to date and recommended
or would someone recommend other resources regarding this matter?
- for me to get my hands into the code it would help to read first some
high-level architectural docs or presentations, or anything that can be
called "a developer guide" and https://www.ffmpeg.org/developer.html is
just a ruleset, nothing really helpful to understand what's going on
inside and where can i start. do you know anything that might be
helpful? also insights from other developers here who already went on
this path would be great and maybe some general unix development help
like what editor/ide/etc are you using, etc, because from the
development point of view, i am coming from a windows environment and
don't have that much experience with linux programming (just some)
2. how can i enforce keyframe alignment also with input which i
would like to simply -c copy ? this means that reencoded outputs
should have the exactly same keyframe placements as the input, thus,
internal codec heuristics should be disabled on this matter.
If the stream is not only copied but also decoded (if only to -f null), it
should be as easy to implement as the other option.
i don't really understand this. how would you just decode the stream in
this case? isn't it decoded for the transcoding process?
like i've said, i want the original to be copied further to a
destination, just to change the containers, something like this:
ffmpeg -i input.mkv -c:v libx264 -s 640x360 -b:v 1000k*-copy_keyframes*
-c:a copy output1.mp4 -c copy output2.mp4
basically, take an input, change container/destination for it but ALSO
transcode it to another resolution, and both output1 and output2 should
pe keyframe-aligned.
this is what i actually aim to try in the patch tentative, this
alignment is missing the most for me: just copy keyframe positions from
input. additionally, scene change detection may be still active for
output1 encoding, i wouldn't mind, but just to insert new keyframes if
the encoder thinks that its smart, leave the existing ones alone.
however, i think this would be easy to disable by the sc_threshold
option. the key point here is "just copy keyframe positions from input".
i am talking about a h264/x264 input/output.
If I remember correctly, with x264, forcing too many keyframes have a big
negative impact on the quality, even if the forced keyframes are exactly
those the encoder would have chosen anyway. You should probably look
carefully at the quality and bitrate of your resulting files.
Regards,
--
Claudiu
_______________________________________________
ffmpeg-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user