Log in

View Full Version : encoding photo shows with x264 - technology question


tecxx
31st March 2013, 16:16
Hello,

my father is travelling a lot, and from all the pictures he shoots on his travels he creates a "photo show" movie, where all the pics are stitched together with audio tracks and self recorded voice tracks etc.

this movie is rendered as a x264 encoded M2TS file, usually about 6-9 GB in size. the video stream is in 1920x1080 pixels format ("export to bluray" function in his editor software)

i was wondering, how is it possible that the file size is so large? movie encoding, as far as i understood it, takes a reference frame (iframe?), and for all subsequent frames only the difference to the reference is stored. when the difference is too large, a new iframe (complete picture) is stored in the stream, and so on. based on this assumption, the resulting movie size should (roughly) not be much larger than the sum of all the single picture sizes.
for an example, let's say we have 100 photos with 8MB each. stitched together, i would assume the entire show not to be much larger than 1GB, maybe 2GB because there are some text inserts etc. but 9GB - why?!

so i took megui, and tried to recompress the m2ts contents without any resizing or other filters. i was hoping that the resulting file size would shrink drastically. but much to my surprise, file size didn't change at all.

am i doing something wrong (incorrect encoder settings?) or do i misunderstand the concept here and it doesn't work this way?

poisondeathray
31st March 2013, 16:21
Hello,

my father is travelling a lot, and from all the pictures he shoots on his travels he creates a "photo show" movie, where all the pics are stitched together with audio tracks and self recorded voice tracks etc.

this movie is rendered as a x264 encoded M2TS file, usually about 6-9 GB in size. the video stream is in 1920x1080 pixels format ("export to bluray" function in his editor software)

i was wondering, how is it possible that the file size is so large? movie encoding, as far as i understood it, takes a reference frame (iframe?), and for all subsequent frames only the difference to the reference is stored. when the difference is too large, a new iframe (complete picture) is stored in the stream, and so on. based on this assumption, the resulting movie size should (roughly) not be much larger than the sum of all the single picture sizes.
for an example, let's say we have 100 photos with 8MB each. stitched together, i would assume the entire show not to be much larger than 1GB, maybe 2GB because there are some text inserts etc. but 9GB - why?!

so i took megui, and tried to recompress the m2ts contents without any resizing or other filters. i was hoping that the resulting file size would shrink drastically. but much to my surprise, file size didn't change at all.

am i doing something wrong (incorrect encoder settings?) or do i misunderstand the concept here and it doesn't work this way?



How did you string the pictures together, what fps and framecount ?

If you display a single picture for 1 second at a frame rate of 29.97 fps , you need 29.97 frames. That's more than a single frame. Either change your FPS lower or do VFR (variable frame rate) encoding . But if this is for blu-ray, VFR and low FPS like 1 are not compatible

vivan
31st March 2013, 16:39
movie encoding, as far as i understood it, takes a reference frame (iframe?), and for all subsequent frames only the difference to the reference is stored. when the difference is too large, a new iframe (complete picture) is stored in the stream, and so on.Bluray encoding requires new iframe each second. That means that even if picture haven't changed it would be duplicated, hence higher stream size.
If your goal isn't encoding for bluray then you can increase keyint (http://mewiki.project357.com/wiki/X264_Settings#keyint) value.

tecxx
1st April 2013, 15:40
thanks to both answers, that clears up some things to me.
i am not targeting blueray devices. we will playback this on pc or LAN streaming boxes.
current megui / x264 Settings are:
Const.Qualty (16), AVC Profile High, AVC Level Autoguess, Default Target Device
program --preset veryslow --tune film --crf 16

@vivan:
i will try the keyint value. it seems to be "Maximum GOP Size" in the GUI... what should i set GOP calculation to: FPS based or Fixed?



@ poisondeathray
the software used is "Magix Foto auf DVD", where we used the "Export" function to render a "BlueRay Disc". i extracted the M2TS file out of it, it has a video stream with these parameters
H264 - MPEG-4 AVC (part 10) (h264), Res: 1920x1080, Framerate: 50
framecount: i don't know how to set that / see it

i definitely should try to lower the FPS to 25, but lower than that isn't possible because the video also contains some animated parts, so FPS of 1 would not work there, i guess.

i will try VFR enconding. i checked some forum threads, it's not immediately clear to me what to do, i need some research time ;)

benwaggoner
1st April 2013, 18:11
This is a job for Variable Frame Rate if I've ever heard one!

What program is he using to author the "photo show"? Maybe there are better outputs than this. Something that allows for VFR and much longer GOP sizes would be a big help.

tecxx
1st April 2013, 18:20
@jq963152
thats great info, thanks. i'll try tune stillimage right away ;)
you are right about the double encode, i will check if the program supports raw exporting later, once i got this part sorted.


@benwaggoner
the software is called "magix foto auf dvd". i think it's not the most "professional" product, but it works for my dad, so i gotta stick with what i get ;)

didn't look into VFR yet. the gop size change already drastically changed things to the better.

tecxx
3rd April 2013, 17:23
ok i figured it out, thanks to everyone here.
i made a mistake when i tried to reencode the 6GB MTS file. i think i messed up the encoder settings by chosing a "fast" preset (to get a quick result and see the final file size). this seems to have turned off / deactivated B frames. i noticed this when playing around with the keyint setting mentioned here, so i decided to create a completely new x264 profile, choose "veryslow" as a preset and "tune stillimage", and not touch anything else, and after the reencode the 6GB mts file shrank to 2GB mkv.
i then did several reencodes on three different of those picture shows, playing around with the keyint settings. interesting result, they didn't make a huge difference (100-200mb). i guess thats because the show contains a lot of transitions and moving text.
anyway, all is good now, i feel a bit stupid for messing this up after beeing a regular megui user for years ;)

thanks again for all the help!