diff --git a/scapy/utils.py b/scapy/utils.py
index e4613094b8949e1054c785dc3ab56987c8c915c5..c9bf4ede25e1d25b673eecfa13e9347ff4324246 100644
--- a/scapy/utils.py
+++ b/scapy/utils.py
@@ -704,11 +704,20 @@ class RawPcapWriter:
         written to the dumpfile
 
         """
-        if not self.header_present:
-            self._write_header(pkt)
         if type(pkt) is str:
+            if not self.header_present:
+                self._write_header(pkt)
             self._write_packet(pkt)
         else:
+            pkt = pkt.__iter__()
+            if not self.header_present:
+                try:
+                    p = pkt.next()
+                except StopIteration:
+                    self._write_header("")
+                    return
+                self._write_header(p)
+                self._write_packet(p)
             for p in pkt:
                 self._write_packet(p)
 
@@ -746,8 +755,6 @@ class RawPcapWriter:
 class PcapWriter(RawPcapWriter):
     def _write_header(self, pkt):
         if self.linktype == None:
-            if type(pkt) is list or type(pkt) is tuple or isinstance(pkt,BasePacketList):
-                pkt = pkt[0]
             try:
                 self.linktype = conf.l2types[pkt.__class__]
             except KeyError: