diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 49aeee74526c4b4347686e95df0f8c0dbc7ce9f6..7c36598ff1d8533f4e8010f88a6a036c33edd7da 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -2514,13 +2514,15 @@ void AddAndCreateES( demux_t *p_demux, ts_pid_t *pid, bool b_create_delayed )
 
     if( pid && p_sys->es_creation == CREATE_ES )
     {
-        DoCreateES( p_demux, pid->u.p_pes->p_es, NULL );
+        ts_pes_es_t *p_es = pid->u.p_pes->p_es;
+        DoCreateES( p_demux, p_es, NULL );
 
         /* Update the default program == first created ES group */
-        if( p_sys->b_default_selection && p_sys->programs.i_size > 0)
+        if( p_sys->b_default_selection && p_sys->programs.i_size > 0 &&
+            (p_es->fmt.i_cat == VIDEO_ES || p_es->fmt.i_cat == AUDIO_ES) )
         {
             p_sys->b_default_selection = false;
-            const int i_first_program = pid->u.p_pes->p_es->p_program->i_number;
+            const int i_first_program = p_es->p_program->i_number;
             if( p_sys->programs.p_elems[0] != i_first_program )
                 p_sys->programs.p_elems[0] = i_first_program;
             msg_Dbg( p_demux, "Default program is %d", i_first_program );
diff --git a/modules/demux/mpeg/ts_psi.c b/modules/demux/mpeg/ts_psi.c
index 0a6254e9f8938097472490f0d4ee85fe33ab6fc1..6fae02cabd9a52d31a6cd8246b3a760e3b9767b9 100644
--- a/modules/demux/mpeg/ts_psi.c
+++ b/modules/demux/mpeg/ts_psi.c
@@ -1582,8 +1582,6 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_dvbpsipmt )
                      (p_dr->p_data[0] << 8) | p_dr->p_data[1] );
         }
 
-        const bool b_create_es = (p_pes->p_es->fmt.i_cat != UNKNOWN_ES);
-
         /* Now check and merge */
         if( b_pid_inuse ) /* We need to compare to the existing pes/es */
         {
@@ -1644,8 +1642,7 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_dvbpsipmt )
             }
         }
         /* Nothing to do, pes is now just set */
-        if( b_create_es )
-            AddAndCreateES( p_demux, pespid, false );
+        AddAndCreateES( p_demux, pespid, false );
     }
 
     /* Set CAM descrambling */