pcap-format provides an interface to encode and decode pcap files, dealing with both endianess, including endianess detection.
pcap-format can be installed with opam:
opam install pcap-formatIf you don't use opam consult the pcap-format.opam file for build instructions.
The documentation and API reference is automatically generated by ocamldoc from the interfaces. It can be consulted online.